@@ -60,17 +60,18 @@ pub use self::dcl::{
6060} ;
6161pub use self :: ddl:: {
6262 AlterColumnOperation , AlterConnectorOwner , AlterIndexOperation , AlterPolicyOperation ,
63- AlterSchema , AlterSchemaOperation , AlterTableAlgorithm , AlterTableLock , AlterTableOperation ,
64- AlterType , AlterTypeAddValue , AlterTypeAddValuePosition , AlterTypeOperation , AlterTypeRename ,
65- AlterTypeRenameValue , ClusteredBy , ColumnDef , ColumnOption , ColumnOptionDef , ColumnOptions ,
66- ColumnPolicy , ColumnPolicyProperty , ConstraintCharacteristics , CreateConnector , CreateDomain ,
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 ,
63+ AlterSchema , AlterSchemaOperation , AlterTable , AlterTableAlgorithm , AlterTableLock ,
64+ AlterTableOperation , AlterType , AlterTypeAddValue , AlterTypeAddValuePosition ,
65+ AlterTypeOperation , AlterTypeRename , AlterTypeRenameValue , ClusteredBy , ColumnDef ,
66+ ColumnOption , ColumnOptionDef , ColumnOptions , ColumnPolicy , ColumnPolicyProperty ,
67+ ConstraintCharacteristics , CreateConnector , CreateDomain , CreateExtension , CreateFunction ,
68+ CreateIndex , CreateTable , CreateTrigger , CreateView , Deduplicate , DeferrableInitial ,
69+ DropBehavior , DropExtension , DropTrigger , GeneratedAs , GeneratedExpressionMode ,
70+ IdentityParameters , IdentityProperty , IdentityPropertyFormatKind , IdentityPropertyKind ,
71+ IdentityPropertyOrder , IndexColumn , IndexOption , IndexType , KeyOrIndexDisplay , Msck ,
72+ NullsDistinctOption , Owner , Partition , ProcedureParam , ReferentialAction , RenameTableNameKind ,
73+ ReplicaIdentity , TableConstraint , TagsColumnOption , Truncate ,
74+ UserDefinedTypeCompositeAttributeDef , UserDefinedTypeRepresentation , ViewColumnDef ,
7475} ;
7576pub use self :: dml:: { Delete , Insert , Update } ;
7677pub use self :: operator:: { BinaryOperator , UnaryOperator } ;
@@ -3311,24 +3312,7 @@ pub enum Statement {
33113312 /// ```sql
33123313 /// ALTER TABLE
33133314 /// ```
3314- AlterTable {
3315- /// Table name
3316- #[ cfg_attr( feature = "visitor" , visit( with = "visit_relation" ) ) ]
3317- name : ObjectName ,
3318- if_exists : bool ,
3319- only : bool ,
3320- operations : Vec < AlterTableOperation > ,
3321- location : Option < HiveSetLocation > ,
3322- /// ClickHouse dialect supports `ON CLUSTER` clause for ALTER TABLE
3323- /// For example: `ALTER TABLE table_name ON CLUSTER cluster_name ADD COLUMN c UInt32`
3324- /// [ClickHouse](https://clickhouse.com/docs/en/sql-reference/statements/alter/update)
3325- on_cluster : Option < Ident > ,
3326- /// Snowflake "ICEBERG" clause for Iceberg tables
3327- /// <https://docs.snowflake.com/en/sql-reference/sql/alter-iceberg-table>
3328- iceberg : bool ,
3329- /// Token that represents the end of the statement (semicolon or EOF)
3330- end_token : AttachedToken ,
3331- } ,
3315+ AlterTable ( AlterTable ) ,
33323316 /// ```sql
33333317 /// ALTER SCHEMA
33343318 /// ```
@@ -3537,10 +3521,9 @@ pub enum Statement {
35373521 CreateExtension ( CreateExtension ) ,
35383522 /// ```sql
35393523 /// DROP EXTENSION [ IF EXISTS ] name [, ...] [ CASCADE | RESTRICT ]
3540- ///
3524+ /// ```
35413525 /// Note: this is a PostgreSQL-specific statement.
35423526 /// https://www.postgresql.org/docs/current/sql-dropextension.html
3543- /// ```
35443527 DropExtension ( DropExtension ) ,
35453528 /// ```sql
35463529 /// FETCH
@@ -4879,42 +4862,7 @@ impl fmt::Display for Statement {
48794862 Ok ( ( ) )
48804863 }
48814864 Statement :: CreateConnector ( create_connector) => create_connector. fmt ( f) ,
4882- Statement :: AlterTable {
4883- name,
4884- if_exists,
4885- only,
4886- operations,
4887- location,
4888- on_cluster,
4889- iceberg,
4890- end_token : _,
4891- } => {
4892- if * iceberg {
4893- write ! ( f, "ALTER ICEBERG TABLE " ) ?;
4894- } else {
4895- write ! ( f, "ALTER TABLE " ) ?;
4896- }
4897-
4898- if * if_exists {
4899- write ! ( f, "IF EXISTS " ) ?;
4900- }
4901- if * only {
4902- write ! ( f, "ONLY " ) ?;
4903- }
4904- write ! ( f, "{name} " ) ?;
4905- if let Some ( cluster) = on_cluster {
4906- write ! ( f, "ON CLUSTER {cluster} " ) ?;
4907- }
4908- write ! (
4909- f,
4910- "{operations}" ,
4911- operations = display_comma_separated( operations)
4912- ) ?;
4913- if let Some ( loc) = location {
4914- write ! ( f, " {loc}" ) ?
4915- }
4916- Ok ( ( ) )
4917- }
4865+ Statement :: AlterTable ( alter_table) => write ! ( f, "{alter_table}" ) ,
49184866 Statement :: AlterIndex { name, operation } => {
49194867 write ! ( f, "ALTER INDEX {name} {operation}" )
49204868 }
@@ -10570,6 +10518,12 @@ impl From<CreateRole> for Statement {
1057010518 }
1057110519}
1057210520
10521+ impl From < AlterTable > for Statement {
10522+ fn from ( at : AlterTable ) -> Self {
10523+ Self :: AlterTable ( at)
10524+ }
10525+ }
10526+
1057310527impl From < CreateExtension > for Statement {
1057410528 fn from ( ce : CreateExtension ) -> Self {
1057510529 Self :: CreateExtension ( ce)
0 commit comments