@@ -3553,6 +3553,20 @@ impl Spanned for DropExtension {
35533553 }
35543554}
35553555
3556+ /// Table type for ALTER TABLE statements.
3557+ /// Used to distinguish between regular tables, Iceberg tables, and Dynamic tables.
3558+ #[ derive( Debug , Clone , PartialEq , PartialOrd , Eq , Ord , Hash ) ]
3559+ #[ cfg_attr( feature = "serde" , derive( Serialize , Deserialize ) ) ]
3560+ #[ cfg_attr( feature = "visitor" , derive( Visit , VisitMut ) ) ]
3561+ pub enum AlterTableType {
3562+ /// Iceberg table type
3563+ /// <https://docs.snowflake.com/en/sql-reference/sql/alter-iceberg-table>
3564+ Iceberg ,
3565+ /// Dynamic table type
3566+ /// <https://docs.snowflake.com/en/sql-reference/sql/alter-table>
3567+ Dynamic ,
3568+ }
3569+
35563570/// ALTER TABLE statement
35573571#[ derive( Debug , Clone , PartialEq , PartialOrd , Eq , Ord , Hash ) ]
35583572#[ cfg_attr( feature = "serde" , derive( Serialize , Deserialize ) ) ]
@@ -3569,24 +3583,18 @@ pub struct AlterTable {
35693583 /// For example: `ALTER TABLE table_name ON CLUSTER cluster_name ADD COLUMN c UInt32`
35703584 /// [ClickHouse](https://clickhouse.com/docs/en/sql-reference/statements/alter/update)
35713585 pub on_cluster : Option < Ident > ,
3572- /// Snowflake "ICEBERG" clause for Iceberg tables
3573- /// <https://docs.snowflake.com/en/sql-reference/sql/alter-iceberg-table>
3574- pub iceberg : bool ,
3575- /// Snowflake "DYNAMIC" clause for Dynamic tables
3576- /// <https://docs.snowflake.com/en/sql-reference/sql/alter-table>
3577- pub dynamic : bool ,
3586+ /// Table type: None for regular tables, Some(AlterTableType) for Iceberg or Dynamic tables
3587+ pub table_type : Option < AlterTableType > ,
35783588 /// Token that represents the end of the statement (semicolon or EOF)
35793589 pub end_token : AttachedToken ,
35803590}
35813591
35823592impl fmt:: Display for AlterTable {
35833593 fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
3584- if self . iceberg {
3585- write ! ( f, "ALTER ICEBERG TABLE " ) ?;
3586- } else if self . dynamic {
3587- write ! ( f, "ALTER DYNAMIC TABLE " ) ?;
3588- } else {
3589- write ! ( f, "ALTER TABLE " ) ?;
3594+ match & self . table_type {
3595+ Some ( AlterTableType :: Iceberg ) => write ! ( f, "ALTER ICEBERG TABLE " ) ?,
3596+ Some ( AlterTableType :: Dynamic ) => write ! ( f, "ALTER DYNAMIC TABLE " ) ?,
3597+ None => write ! ( f, "ALTER TABLE " ) ?,
35903598 }
35913599
35923600 if self . if_exists {
0 commit comments