@@ -4409,6 +4409,13 @@ pub enum Statement {
4409
4409
/// ```
4410
4410
/// [Snowflake](https://docs.snowflake.com/en/sql-reference/sql/create-user)
4411
4411
CreateUser ( CreateUser ) ,
4412
+ /// Re-sorts rows and reclaims space in either a specified table or all tables in the current database
4413
+ ///
4414
+ /// ```sql
4415
+ /// VACUUM tbl
4416
+ /// ```
4417
+ /// [Redshift](https://docs.aws.amazon.com/redshift/latest/dg/r_VACUUM_command.html)
4418
+ Vacuum ( VacuumStatement ) ,
4412
4419
}
4413
4420
4414
4421
/// ```sql
@@ -6343,6 +6350,7 @@ impl fmt::Display for Statement {
6343
6350
Statement :: ExportData ( e) => write ! ( f, "{e}" ) ,
6344
6351
Statement :: CreateUser ( s) => write ! ( f, "{s}" ) ,
6345
6352
Statement :: AlterSchema ( s) => write ! ( f, "{s}" ) ,
6353
+ Statement :: Vacuum ( s) => write ! ( f, "{s}" ) ,
6346
6354
}
6347
6355
}
6348
6356
}
@@ -10604,6 +10612,50 @@ impl fmt::Display for InitializeKind {
10604
10612
}
10605
10613
}
10606
10614
10615
+ /// Re-sorts rows and reclaims space in either a specified table or all tables in the current database
10616
+ ///
10617
+ /// '''sql
10618
+ /// VACUUM [ FULL | SORT ONLY | DELETE ONLY | REINDEX | RECLUSTER ] [ \[ table_name \] [ TO threshold PERCENT ] \[ BOOST \] ]
10619
+ /// '''
10620
+ /// [Redshift](https://docs.aws.amazon.com/redshift/latest/dg/r_VACUUM_command.html)
10621
+ #[ derive( Debug , Clone , PartialEq , PartialOrd , Eq , Ord , Hash ) ]
10622
+ #[ cfg_attr( feature = "serde" , derive( Serialize , Deserialize ) ) ]
10623
+ #[ cfg_attr( feature = "visitor" , derive( Visit , VisitMut ) ) ]
10624
+ pub struct VacuumStatement {
10625
+ pub full : bool ,
10626
+ pub sort_only : bool ,
10627
+ pub delete_only : bool ,
10628
+ pub reindex : bool ,
10629
+ pub recluster : bool ,
10630
+ pub table_name : Option < ObjectName > ,
10631
+ pub threshold : Option < Value > ,
10632
+ pub boost : bool ,
10633
+ }
10634
+
10635
+ impl fmt:: Display for VacuumStatement {
10636
+ fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
10637
+ write ! (
10638
+ f,
10639
+ "VACUUM{}{}{}{}{}" ,
10640
+ if self . full { " FULL" } else { "" } ,
10641
+ if self . sort_only { " SORT ONLY" } else { "" } ,
10642
+ if self . delete_only { " DELETE ONLY" } else { "" } ,
10643
+ if self . reindex { " REINDEX" } else { "" } ,
10644
+ if self . recluster { " RECLUSTER" } else { "" } ,
10645
+ ) ?;
10646
+ if let Some ( table_name) = & self . table_name {
10647
+ write ! ( f, " {table_name}" ) ?;
10648
+ }
10649
+ if let Some ( threshold) = & self . threshold {
10650
+ write ! ( f, " TO {threshold} PERCENT" ) ?;
10651
+ }
10652
+ if self . boost {
10653
+ write ! ( f, " BOOST" ) ?;
10654
+ }
10655
+ Ok ( ( ) )
10656
+ }
10657
+ }
10658
+
10607
10659
#[ cfg( test) ]
10608
10660
mod tests {
10609
10661
use crate :: tokenizer:: Location ;
0 commit comments