@@ -64,13 +64,13 @@ pub use self::ddl::{
6464 AlterType , AlterTypeAddValue , AlterTypeAddValuePosition , AlterTypeOperation , AlterTypeRename ,
6565 AlterTypeRenameValue , ClusteredBy , ColumnDef , ColumnOption , ColumnOptionDef , ColumnOptions ,
6666 ColumnPolicy , ColumnPolicyProperty , ConstraintCharacteristics , CreateConnector , CreateDomain ,
67- CreateFunction , CreateIndex , CreateTable , CreateTrigger , CreateView , Deduplicate ,
68- DeferrableInitial , DropBehavior , DropTrigger , GeneratedAs , GeneratedExpressionMode ,
69- IdentityParameters , IdentityProperty , IdentityPropertyFormatKind , IdentityPropertyKind ,
70- IdentityPropertyOrder , IndexColumn , IndexOption , IndexType , KeyOrIndexDisplay , Msck ,
71- NullsDistinctOption , Owner , Partition , ProcedureParam , ReferentialAction , RenameTableNameKind ,
72- ReplicaIdentity , TableConstraint , TagsColumnOption , Truncate ,
73- UserDefinedTypeCompositeAttributeDef , UserDefinedTypeRepresentation , ViewColumnDef ,
67+ CreateExtension , CreateFunction , CreateIndex , CreateTable , CreateTrigger , CreateView ,
68+ Deduplicate , DeferrableInitial , DropBehavior , DropExtension , DropTrigger , GeneratedAs ,
69+ GeneratedExpressionMode , IdentityParameters , IdentityProperty , IdentityPropertyFormatKind ,
70+ IdentityPropertyKind , IdentityPropertyOrder , IndexColumn , IndexOption , IndexType ,
71+ KeyOrIndexDisplay , Msck , NullsDistinctOption , Owner , Partition , ProcedureParam ,
72+ ReferentialAction , RenameTableNameKind , ReplicaIdentity , TableConstraint , TagsColumnOption ,
73+ Truncate , UserDefinedTypeCompositeAttributeDef , UserDefinedTypeRepresentation , ViewColumnDef ,
7474} ;
7575pub use self :: dml:: { Delete , Insert , Update } ;
7676pub use self :: operator:: { BinaryOperator , UnaryOperator } ;
@@ -3534,25 +3534,14 @@ pub enum Statement {
35343534 /// ```
35353535 ///
35363536 /// Note: this is a PostgreSQL-specific statement,
3537- CreateExtension {
3538- name : Ident ,
3539- if_not_exists : bool ,
3540- cascade : bool ,
3541- schema : Option < Ident > ,
3542- version : Option < Ident > ,
3543- } ,
3537+ CreateExtension ( CreateExtension ) ,
35443538 /// ```sql
35453539 /// DROP EXTENSION [ IF EXISTS ] name [, ...] [ CASCADE | RESTRICT ]
35463540 ///
35473541 /// Note: this is a PostgreSQL-specific statement.
35483542 /// https://www.postgresql.org/docs/current/sql-dropextension.html
35493543 /// ```
3550- DropExtension {
3551- names : Vec < Ident > ,
3552- if_exists : bool ,
3553- /// `CASCADE` or `RESTRICT`
3554- cascade_or_restrict : Option < ReferentialAction > ,
3555- } ,
3544+ DropExtension ( DropExtension ) ,
35563545 /// ```sql
35573546 /// FETCH
35583547 /// ```
@@ -4806,49 +4795,8 @@ impl fmt::Display for Statement {
48064795 Ok ( ( ) )
48074796 }
48084797 Statement :: CreateIndex ( create_index) => create_index. fmt ( f) ,
4809- Statement :: CreateExtension {
4810- name,
4811- if_not_exists,
4812- cascade,
4813- schema,
4814- version,
4815- } => {
4816- write ! (
4817- f,
4818- "CREATE EXTENSION {if_not_exists}{name}" ,
4819- if_not_exists = if * if_not_exists { "IF NOT EXISTS " } else { "" }
4820- ) ?;
4821- if * cascade || schema. is_some ( ) || version. is_some ( ) {
4822- write ! ( f, " WITH" ) ?;
4823-
4824- if let Some ( name) = schema {
4825- write ! ( f, " SCHEMA {name}" ) ?;
4826- }
4827- if let Some ( version) = version {
4828- write ! ( f, " VERSION {version}" ) ?;
4829- }
4830- if * cascade {
4831- write ! ( f, " CASCADE" ) ?;
4832- }
4833- }
4834-
4835- Ok ( ( ) )
4836- }
4837- Statement :: DropExtension {
4838- names,
4839- if_exists,
4840- cascade_or_restrict,
4841- } => {
4842- write ! ( f, "DROP EXTENSION" ) ?;
4843- if * if_exists {
4844- write ! ( f, " IF EXISTS" ) ?;
4845- }
4846- write ! ( f, " {}" , display_comma_separated( names) ) ?;
4847- if let Some ( cascade_or_restrict) = cascade_or_restrict {
4848- write ! ( f, " {cascade_or_restrict}" ) ?;
4849- }
4850- Ok ( ( ) )
4851- }
4798+ Statement :: CreateExtension ( create_extension) => write ! ( f, "{create_extension}" ) ,
4799+ Statement :: DropExtension ( drop_extension) => write ! ( f, "{drop_extension}" ) ,
48524800 Statement :: CreateRole ( create_role) => write ! ( f, "{create_role}" ) ,
48534801 Statement :: CreateSecret {
48544802 or_replace,
@@ -10622,6 +10570,18 @@ impl From<CreateRole> for Statement {
1062210570 }
1062310571}
1062410572
10573+ impl From < CreateExtension > for Statement {
10574+ fn from ( ce : CreateExtension ) -> Self {
10575+ Self :: CreateExtension ( ce)
10576+ }
10577+ }
10578+
10579+ impl From < DropExtension > for Statement {
10580+ fn from ( de : DropExtension ) -> Self {
10581+ Self :: DropExtension ( de)
10582+ }
10583+ }
10584+
1062510585impl From < CaseStatement > for Statement {
1062610586 fn from ( c : CaseStatement ) -> Self {
1062710587 Self :: Case ( c)
0 commit comments