@@ -31,7 +31,7 @@ use crate::ast::{
3131 ColumnPolicy , ColumnPolicyProperty , ContactEntry , CopyIntoSnowflakeKind , CreateTableLikeKind ,
3232 DollarQuotedString , Ident , IdentityParameters , IdentityProperty , IdentityPropertyFormatKind ,
3333 IdentityPropertyKind , IdentityPropertyOrder , InitializeKind , ObjectName , ObjectNamePart ,
34- RefreshModeKind , RowAccessPolicy , ShowObjects , SqlOption , Statement ,
34+ RefreshModeKind , RenameTableNameKind , RowAccessPolicy , ShowObjects , SqlOption , Statement ,
3535 StorageSerializationPolicy , TagsColumnOption , Value , WrappedCollection ,
3636} ;
3737use crate :: dialect:: { Dialect , Precedence } ;
@@ -660,11 +660,19 @@ fn parse_alter_external_table(parser: &mut Parser) -> Result<Statement, ParserEr
660660 let if_exists = parser. parse_keywords ( & [ Keyword :: IF , Keyword :: EXISTS ] ) ;
661661 let table_name = parser. parse_object_name ( true ) ?;
662662
663- // Parse the operation (REFRESH for now, can be extended)
663+ // Parse the operation
664664 let operation = if parser. parse_keyword ( Keyword :: REFRESH ) {
665665 AlterTableOperation :: Refresh
666+ } else if parser. parse_keywords ( & [ Keyword :: RENAME , Keyword :: TO ] ) {
667+ let new_table_name = parser. parse_object_name ( false ) ?;
668+ AlterTableOperation :: RenameTable {
669+ table_name : RenameTableNameKind :: To ( new_table_name) ,
670+ }
666671 } else {
667- return parser. expected ( "REFRESH after ALTER EXTERNAL TABLE" , parser. peek_token ( ) ) ;
672+ return parser. expected (
673+ "REFRESH or RENAME TO after ALTER EXTERNAL TABLE" ,
674+ parser. peek_token ( ) ,
675+ ) ;
668676 } ;
669677
670678 let end_token = if parser. peek_token_ref ( ) . token == Token :: SemiColon {
0 commit comments