@@ -65,7 +65,6 @@ pub enum AlterTableOperation {
6565 name : Ident ,
6666 select : ProjectionSelect ,
6767 } ,
68-
6968 /// `DROP PROJECTION [IF EXISTS] name`
7069 ///
7170 /// Note: this is a ClickHouse-specific operation.
@@ -74,7 +73,6 @@ pub enum AlterTableOperation {
7473 if_exists : bool ,
7574 name : Ident ,
7675 } ,
77-
7876 /// `MATERIALIZE PROJECTION [IF EXISTS] name [IN PARTITION partition_name]`
7977 ///
8078 /// Note: this is a ClickHouse-specific operation.
@@ -84,7 +82,6 @@ pub enum AlterTableOperation {
8482 name : Ident ,
8583 partition : Option < Ident > ,
8684 } ,
87-
8885 /// `CLEAR PROJECTION [IF EXISTS] name [IN PARTITION partition_name]`
8986 ///
9087 /// Note: this is a ClickHouse-specific operation.
@@ -94,7 +91,6 @@ pub enum AlterTableOperation {
9491 name : Ident ,
9592 partition : Option < Ident > ,
9693 } ,
97-
9894 /// `DISABLE ROW LEVEL SECURITY`
9995 ///
10096 /// Note: this is a PostgreSQL-specific operation.
@@ -272,6 +268,15 @@ pub enum AlterTableOperation {
272268 DropClusteringKey ,
273269 SuspendRecluster ,
274270 ResumeRecluster ,
271+ /// `ALGORITHM [=] { DEFAULT | INSTANT | INPLACE | COPY }`
272+ ///
273+ /// [MySQL]-specific table alter algorithm.
274+ ///
275+ /// [MySQL]: https://dev.mysql.com/doc/refman/8.4/en/alter-table.html
276+ Algorithm {
277+ equals : bool ,
278+ algorithm : AlterTableAlgorithm ,
279+ } ,
275280}
276281
277282/// An `ALTER Policy` (`Statement::AlterPolicy`) operation
@@ -317,6 +322,30 @@ impl fmt::Display for AlterPolicyOperation {
317322 }
318323}
319324
325+ /// [MySQL] `ALTER TABLE` algorithm.
326+ ///
327+ /// [MySQL]: https://dev.mysql.com/doc/refman/8.4/en/alter-table.html
328+ #[ derive( Debug , Clone , PartialEq , PartialOrd , Eq , Ord , Hash ) ]
329+ #[ cfg_attr( feature = "serde" , derive( Serialize , Deserialize ) ) ]
330+ #[ cfg_attr( feature = "visitor" , derive( Visit , VisitMut ) ) ]
331+ pub enum AlterTableAlgorithm {
332+ Default ,
333+ Instant ,
334+ Inplace ,
335+ Copy ,
336+ }
337+
338+ impl fmt:: Display for AlterTableAlgorithm {
339+ fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
340+ f. write_str ( match self {
341+ Self :: Default => "DEFAULT" ,
342+ Self :: Instant => "INSTANT" ,
343+ Self :: Inplace => "INPLACE" ,
344+ Self :: Copy => "COPY" ,
345+ } )
346+ }
347+ }
348+
320349#[ derive( Debug , Clone , PartialEq , PartialOrd , Eq , Ord , Hash ) ]
321350#[ cfg_attr( feature = "serde" , derive( Serialize , Deserialize ) ) ]
322351#[ cfg_attr( feature = "visitor" , derive( Visit , VisitMut ) ) ]
@@ -407,6 +436,14 @@ impl fmt::Display for AlterTableOperation {
407436 }
408437 write ! ( f, " {} ({})" , name, query)
409438 }
439+ AlterTableOperation :: Algorithm { equals, algorithm } => {
440+ write ! (
441+ f,
442+ "ALGORITHM {}{}" ,
443+ if * equals { "= " } else { "" } ,
444+ algorithm
445+ )
446+ }
410447 AlterTableOperation :: DropProjection { if_exists, name } => {
411448 write ! ( f, "DROP PROJECTION" ) ?;
412449 if * if_exists {
0 commit comments