@@ -4403,6 +4403,13 @@ pub enum Statement {
44034403 /// ```
44044404 /// [Snowflake](https://docs.snowflake.com/en/sql-reference/sql/create-user)
44054405 CreateUser ( CreateUser ) ,
4406+ /// Re-sorts rows and reclaims space in either a specified table or all tables in the current database
4407+ ///
4408+ /// ```sql
4409+ /// VACUUM tbl
4410+ /// ```
4411+ /// [Redshift](https://docs.aws.amazon.com/redshift/latest/dg/r_VACUUM_command.html)
4412+ Vacuum ( VacuumStatement ) ,
44064413}
44074414
44084415/// ```sql
@@ -6336,6 +6343,7 @@ impl fmt::Display for Statement {
63366343 Statement :: Remove ( command) => write ! ( f, "REMOVE {command}" ) ,
63376344 Statement :: ExportData ( e) => write ! ( f, "{e}" ) ,
63386345 Statement :: CreateUser ( s) => write ! ( f, "{s}" ) ,
6346+ Statement :: Vacuum ( s) => write ! ( f, "{s}" ) ,
63396347 }
63406348 }
63416349}
@@ -10597,6 +10605,50 @@ impl fmt::Display for InitializeKind {
1059710605 }
1059810606}
1059910607
10608+ /// Re-sorts rows and reclaims space in either a specified table or all tables in the current database
10609+ ///
10610+ /// '''sql
10611+ /// VACUUM [ FULL | SORT ONLY | DELETE ONLY | REINDEX | RECLUSTER ] [ \[ table_name \] [ TO threshold PERCENT ] \[ BOOST \] ]
10612+ /// '''
10613+ /// [Redshift](https://docs.aws.amazon.com/redshift/latest/dg/r_VACUUM_command.html)
10614+ #[ derive( Debug , Clone , PartialEq , PartialOrd , Eq , Ord , Hash ) ]
10615+ #[ cfg_attr( feature = "serde" , derive( Serialize , Deserialize ) ) ]
10616+ #[ cfg_attr( feature = "visitor" , derive( Visit , VisitMut ) ) ]
10617+ pub struct VacuumStatement {
10618+ pub full : bool ,
10619+ pub sort_only : bool ,
10620+ pub delete_only : bool ,
10621+ pub reindex : bool ,
10622+ pub recluster : bool ,
10623+ pub table_name : Option < ObjectName > ,
10624+ pub threshold : Option < Value > ,
10625+ pub boost : bool ,
10626+ }
10627+
10628+ impl fmt:: Display for VacuumStatement {
10629+ fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
10630+ write ! (
10631+ f,
10632+ "VACUUM{}{}{}{}{}" ,
10633+ if self . full { " FULL" } else { "" } ,
10634+ if self . sort_only { " SORT ONLY" } else { "" } ,
10635+ if self . delete_only { " DELETE ONLY" } else { "" } ,
10636+ if self . reindex { " REINDEX" } else { "" } ,
10637+ if self . recluster { " RECLUSTER" } else { "" } ,
10638+ ) ?;
10639+ if let Some ( table_name) = & self . table_name {
10640+ write ! ( f, " {table_name}" ) ?;
10641+ }
10642+ if let Some ( threshold) = & self . threshold {
10643+ write ! ( f, " TO {threshold} PERCENT" ) ?;
10644+ }
10645+ if self . boost {
10646+ write ! ( f, " BOOST" ) ?;
10647+ }
10648+ Ok ( ( ) )
10649+ }
10650+ }
10651+
1060010652#[ cfg( test) ]
1060110653mod tests {
1060210654 use crate :: tokenizer:: Location ;
0 commit comments