@@ -3316,6 +3316,18 @@ pub enum Statement {
33163316 options : Vec < SecretOption > ,
33173317 } ,
33183318 /// ```sql
3319+ /// CREATE SERVER
3320+ /// ```
3321+ /// See [PostgreSQL](https://www.postgresql.org/docs/current/sql-createserver.html)
3322+ CreateServer {
3323+ name : ObjectName ,
3324+ if_not_exists : bool ,
3325+ server_type : Option < Ident > ,
3326+ version : Option < Ident > ,
3327+ fdw_name : ObjectName ,
3328+ options : Option < Vec < ServerOption > > ,
3329+ } ,
3330+ /// ```sql
33193331 /// CREATE POLICY
33203332 /// ```
33213333 /// See [PostgreSQL](https://www.postgresql.org/docs/current/sql-createpolicy.html)
@@ -5175,6 +5187,36 @@ impl fmt::Display for Statement {
51755187 write ! ( f, " )" ) ?;
51765188 Ok ( ( ) )
51775189 }
5190+ Statement :: CreateServer {
5191+ name,
5192+ if_not_exists,
5193+ server_type,
5194+ version,
5195+ fdw_name,
5196+ options
5197+ } => {
5198+ write ! (
5199+ f,
5200+ "CREATE SERVER {if_not_exists}{name} " ,
5201+ if_not_exists = if * if_not_exists { "IF NOT EXISTS " } else { "" } ,
5202+ ) ?;
5203+
5204+ if let Some ( st) = server_type {
5205+ write ! ( f, "TYPE {st} " ) ?;
5206+ }
5207+
5208+ if let Some ( v) = version {
5209+ write ! ( f, "VERSION {v} " ) ?;
5210+ }
5211+
5212+ write ! ( f, "FOREIGN DATA WRAPPER {fdw_name}" ) ?;
5213+
5214+ if let Some ( o) = options {
5215+ write ! ( f, " OPTIONS ({o})" , o = display_comma_separated( o) ) ?;
5216+ }
5217+
5218+ Ok ( ( ) )
5219+ }
51785220 Statement :: CreatePolicy {
51795221 name,
51805222 table_name,
@@ -7973,6 +8015,20 @@ impl fmt::Display for SecretOption {
79738015 }
79748016}
79758017
8018+ #[ derive( Debug , Clone , PartialEq , PartialOrd , Eq , Ord , Hash ) ]
8019+ #[ cfg_attr( feature = "serde" , derive( Serialize , Deserialize ) ) ]
8020+ #[ cfg_attr( feature = "visitor" , derive( Visit , VisitMut ) ) ]
8021+ pub struct ServerOption {
8022+ pub key : Ident ,
8023+ pub value : Ident ,
8024+ }
8025+
8026+ impl fmt:: Display for ServerOption {
8027+ fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
8028+ write ! ( f, "{} {}" , self . key, self . value)
8029+ }
8030+ }
8031+
79768032#[ derive( Debug , Clone , PartialEq , PartialOrd , Eq , Ord , Hash ) ]
79778033#[ cfg_attr( feature = "serde" , derive( Serialize , Deserialize ) ) ]
79788034#[ cfg_attr( feature = "visitor" , derive( Visit , VisitMut ) ) ]
0 commit comments