@@ -3413,6 +3413,13 @@ pub enum Statement {
34133413 partitioned : Option < Vec < Expr > > ,
34143414 table_format : Option < HiveLoadDataFormat > ,
34153415 } ,
3416+ /// ```sql
3417+ /// Rename TABLE tbl_name TO new_tbl_name[, tbl_name2 TO new_tbl_name2] ...
3418+ /// ```
3419+ /// Renames one or more tables
3420+ ///
3421+ /// See Mysql <https://dev.mysql.com/doc/refman/9.1/en/rename-table.html>
3422+ RenameTable ( Vec < RenameTable > ) ,
34163423}
34173424
34183425impl fmt:: Display for Statement {
@@ -4970,6 +4977,9 @@ impl fmt::Display for Statement {
49704977 }
49714978 Ok ( ( ) )
49724979 }
4980+ Statement :: RenameTable ( rename_tables) => {
4981+ write ! ( f, "RENAME TABLE {}" , display_comma_separated( rename_tables) )
4982+ }
49734983 }
49744984 }
49754985}
@@ -7672,6 +7682,22 @@ impl Display for JsonNullClause {
76727682 }
76737683}
76747684
7685+ /// rename object definition
7686+ #[ derive( Debug , Clone , PartialEq , PartialOrd , Eq , Ord , Hash ) ]
7687+ #[ cfg_attr( feature = "serde" , derive( Serialize , Deserialize ) ) ]
7688+ #[ cfg_attr( feature = "visitor" , derive( Visit , VisitMut ) ) ]
7689+ pub struct RenameTable {
7690+ pub old_name : ObjectName ,
7691+ pub new_name : ObjectName ,
7692+ }
7693+
7694+ impl fmt:: Display for RenameTable {
7695+ fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
7696+ write ! ( f, "{} TO {}" , self . old_name, self . new_name) ?;
7697+ Ok ( ( ) )
7698+ }
7699+ }
7700+
76757701#[ cfg( test) ]
76767702mod tests {
76777703 use super :: * ;
0 commit comments