@@ -3431,6 +3431,13 @@ pub enum Statement {
34313431 partitioned : Option < Vec < Expr > > ,
34323432 table_format : Option < HiveLoadDataFormat > ,
34333433 } ,
3434+ /// ```sql
3435+ /// Rename TABLE tbl_name TO new_tbl_name[, tbl_name2 TO new_tbl_name2] ...
3436+ /// ```
3437+ /// Renames one or more tables
3438+ ///
3439+ /// See Mysql <https://dev.mysql.com/doc/refman/9.1/en/rename-table.html>
3440+ RenameTable ( Vec < RenameTable > ) ,
34343441}
34353442
34363443impl fmt:: Display for Statement {
@@ -4988,6 +4995,9 @@ impl fmt::Display for Statement {
49884995 }
49894996 Ok ( ( ) )
49904997 }
4998+ Statement :: RenameTable ( rename_tables) => {
4999+ write ! ( f, "RENAME TABLE {}" , display_comma_separated( rename_tables) )
5000+ }
49915001 }
49925002 }
49935003}
@@ -7690,6 +7700,22 @@ impl Display for JsonNullClause {
76907700 }
76917701}
76927702
7703+ /// rename object definition
7704+ #[ derive( Debug , Clone , PartialEq , PartialOrd , Eq , Ord , Hash ) ]
7705+ #[ cfg_attr( feature = "serde" , derive( Serialize , Deserialize ) ) ]
7706+ #[ cfg_attr( feature = "visitor" , derive( Visit , VisitMut ) ) ]
7707+ pub struct RenameTable {
7708+ pub old_name : ObjectName ,
7709+ pub new_name : ObjectName ,
7710+ }
7711+
7712+ impl fmt:: Display for RenameTable {
7713+ fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
7714+ write ! ( f, "{} TO {}" , self . old_name, self . new_name) ?;
7715+ Ok ( ( ) )
7716+ }
7717+ }
7718+
76937719#[ cfg( test) ]
76947720mod tests {
76957721 use super :: * ;
0 commit comments