@@ -10108,12 +10108,15 @@ impl fmt::Display for CreateUser {
1010810108
1010910109/// Modifies the properties of a user
1011010110///
10111- /// Syntax:
10111+ /// [Snowflake Syntax:](https://docs.snowflake.com/en/sql-reference/sql/alter-user)
1011210112/// ```sql
1011310113/// ALTER USER [ IF EXISTS ] [ <name> ] [ OPTIONS ]
1011410114/// ```
1011510115///
10116- /// [Snowflake](https://docs.snowflake.com/en/sql-reference/sql/alter-user)
10116+ /// [PostgreSQL Syntax:](https://www.postgresql.org/docs/current/sql-alteruser.html)
10117+ /// ```sql
10118+ /// ALTER USER <role_specification> [ WITH ] option [ ... ]
10119+ /// ```
1011710120#[ derive( Debug , Clone , PartialEq , PartialOrd , Eq , Ord , Hash ) ]
1011810121#[ cfg_attr( feature = "serde" , derive( Serialize , Deserialize ) ) ]
1011910122#[ cfg_attr( feature = "visitor" , derive( Visit , VisitMut ) ) ]
@@ -10137,6 +10140,8 @@ pub struct AlterUser {
1013710140 pub unset_tag : Vec < String > ,
1013810141 pub set_props : KeyValueOptions ,
1013910142 pub unset_props : Vec < String > ,
10143+ /// The following options are PostgreSQL-specific: <https://www.postgresql.org/docs/current/sql-alteruser.html>
10144+ pub password : Option < AlterUserPassword > ,
1014010145}
1014110146
1014210147/// ```sql
@@ -10313,6 +10318,34 @@ impl fmt::Display for AlterUser {
1031310318 if !self . unset_props . is_empty ( ) {
1031410319 write ! ( f, " UNSET {}" , display_comma_separated( & self . unset_props) ) ?;
1031510320 }
10321+ if let Some ( password) = & self . password {
10322+ write ! ( f, " {}" , password) ?;
10323+ }
10324+ Ok ( ( ) )
10325+ }
10326+ }
10327+
10328+ /// ```sql
10329+ /// ALTER USER <role_specification> [ WITH ] PASSWORD { 'password' | NULL }``
10330+ /// ```
10331+ #[ derive( Debug , Clone , PartialEq , PartialOrd , Eq , Ord , Hash ) ]
10332+ #[ cfg_attr( feature = "serde" , derive( Serialize , Deserialize ) ) ]
10333+ #[ cfg_attr( feature = "visitor" , derive( Visit , VisitMut ) ) ]
10334+ pub struct AlterUserPassword {
10335+ pub encrypted : bool ,
10336+ pub password : Option < String > ,
10337+ }
10338+
10339+ impl Display for AlterUserPassword {
10340+ fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
10341+ if self . encrypted {
10342+ write ! ( f, "ENCRYPTED " ) ?;
10343+ }
10344+ write ! ( f, "PASSWORD" ) ?;
10345+ match & self . password {
10346+ None => write ! ( f, " NULL" ) ?,
10347+ Some ( password) => write ! ( f, " '{}'" , value:: escape_single_quote_string( password) ) ?,
10348+ }
1031610349 Ok ( ( ) )
1031710350 }
1031810351}
0 commit comments