@@ -10046,12 +10046,15 @@ impl fmt::Display for CreateUser {
1004610046
1004710047/// Modifies the properties of a user
1004810048///
10049- /// Syntax:
10049+ /// [Snowflake Syntax] :
1005010050/// ```sql
1005110051/// ALTER USER [ IF EXISTS ] [ <name> ] [ OPTIONS ]
1005210052/// ```
1005310053///
10054- /// [Snowflake](https://docs.snowflake.com/en/sql-reference/sql/alter-user)
10054+ /// [PostgreSQL Syntax]:(https://www.postgresql.org/docs/current/sql-alteruser.html)
10055+ /// ```sql
10056+ /// ALTER USER <role_specification> [ WITH ] option [ ... ]
10057+ /// ```
1005510058#[ derive( Debug , Clone , PartialEq , PartialOrd , Eq , Ord , Hash ) ]
1005610059#[ cfg_attr( feature = "serde" , derive( Serialize , Deserialize ) ) ]
1005710060#[ cfg_attr( feature = "visitor" , derive( Visit , VisitMut ) ) ]
@@ -10075,6 +10078,8 @@ pub struct AlterUser {
1007510078 pub unset_tag : Vec < String > ,
1007610079 pub set_props : KeyValueOptions ,
1007710080 pub unset_props : Vec < String > ,
10081+ /// The following options are PostgreSQL-specific: <https://www.postgresql.org/docs/current/sql-alteruser.html>
10082+ pub password : Option < AlterUserPassword > ,
1007810083}
1007910084
1008010085/// ```sql
@@ -10251,6 +10256,34 @@ impl fmt::Display for AlterUser {
1025110256 if !self . unset_props . is_empty ( ) {
1025210257 write ! ( f, " UNSET {}" , display_comma_separated( & self . unset_props) ) ?;
1025310258 }
10259+ if let Some ( password) = & self . password {
10260+ write ! ( f, " {}" , password) ?;
10261+ }
10262+ Ok ( ( ) )
10263+ }
10264+ }
10265+
10266+ /// ```sql
10267+ /// ALTER USER <role_specification> [ WITH ] PASSWORD { 'password' | NULL }``
10268+ /// ```
10269+ #[ derive( Debug , Clone , PartialEq , PartialOrd , Eq , Ord , Hash ) ]
10270+ #[ cfg_attr( feature = "serde" , derive( Serialize , Deserialize ) ) ]
10271+ #[ cfg_attr( feature = "visitor" , derive( Visit , VisitMut ) ) ]
10272+ pub struct AlterUserPassword {
10273+ pub encrypted : bool ,
10274+ pub password : Option < String > ,
10275+ }
10276+
10277+ impl Display for AlterUserPassword {
10278+ fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
10279+ write ! ( f, "PASSWORD" ) ?;
10280+ if self . encrypted {
10281+ write ! ( f, " ENCRYPTED" ) ?;
10282+ }
10283+ match & self . password {
10284+ None => write ! ( f, " NULL" ) ?,
10285+ Some ( password) => write ! ( f, " '{}'" , value:: escape_single_quote_string( password) ) ?,
10286+ }
1025410287 Ok ( ( ) )
1025510288 }
1025610289}
0 commit comments