@@ -11171,12 +11171,15 @@ impl fmt::Display for CreateUser {
1117111171
1117211172/// Modifies the properties of a user
1117311173///
11174- /// Syntax:
11174+ /// [Snowflake Syntax:](https://docs.snowflake.com/en/sql-reference/sql/alter-user)
1117511175/// ```sql
1117611176/// ALTER USER [ IF EXISTS ] [ <name> ] [ OPTIONS ]
1117711177/// ```
1117811178///
11179- /// [Snowflake](https://docs.snowflake.com/en/sql-reference/sql/alter-user)
11179+ /// [PostgreSQL Syntax:](https://www.postgresql.org/docs/current/sql-alteruser.html)
11180+ /// ```sql
11181+ /// ALTER USER <role_specification> [ WITH ] option [ ... ]
11182+ /// ```
1118011183#[ derive( Debug , Clone , PartialEq , PartialOrd , Eq , Ord , Hash ) ]
1118111184#[ cfg_attr( feature = "serde" , derive( Serialize , Deserialize ) ) ]
1118211185#[ cfg_attr( feature = "visitor" , derive( Visit , VisitMut ) ) ]
@@ -11218,6 +11221,8 @@ pub struct AlterUser {
1121811221 pub set_props : KeyValueOptions ,
1121911222 /// Properties to unset on the user.
1122011223 pub unset_props : Vec < String > ,
11224+ /// The following options are PostgreSQL-specific: <https://www.postgresql.org/docs/current/sql-alteruser.html>
11225+ pub password : Option < AlterUserPassword > ,
1122111226}
1122211227
1122311228/// ```sql
@@ -11409,6 +11414,34 @@ impl fmt::Display for AlterUser {
1140911414 if !self . unset_props . is_empty ( ) {
1141011415 write ! ( f, " UNSET {}" , display_comma_separated( & self . unset_props) ) ?;
1141111416 }
11417+ if let Some ( password) = & self . password {
11418+ write ! ( f, " {}" , password) ?;
11419+ }
11420+ Ok ( ( ) )
11421+ }
11422+ }
11423+
11424+ /// ```sql
11425+ /// ALTER USER <role_specification> [ WITH ] PASSWORD { 'password' | NULL }``
11426+ /// ```
11427+ #[ derive( Debug , Clone , PartialEq , PartialOrd , Eq , Ord , Hash ) ]
11428+ #[ cfg_attr( feature = "serde" , derive( Serialize , Deserialize ) ) ]
11429+ #[ cfg_attr( feature = "visitor" , derive( Visit , VisitMut ) ) ]
11430+ pub struct AlterUserPassword {
11431+ pub encrypted : bool ,
11432+ pub password : Option < String > ,
11433+ }
11434+
11435+ impl Display for AlterUserPassword {
11436+ fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
11437+ if self . encrypted {
11438+ write ! ( f, "ENCRYPTED " ) ?;
11439+ }
11440+ write ! ( f, "PASSWORD" ) ?;
11441+ match & self . password {
11442+ None => write ! ( f, " NULL" ) ?,
11443+ Some ( password) => write ! ( f, " '{}'" , value:: escape_single_quote_string( password) ) ?,
11444+ }
1141211445 Ok ( ( ) )
1141311446 }
1141411447}
0 commit comments