Keep the COLUMN keyword only if it exists when dropping the column (#1862)

This commit is contained in:
hulk 2025-05-28 13:09:40 +08:00 committed by GitHub
parent 301726541a
commit 9159d08c5e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 12 additions and 4 deletions

View file

@ -8608,11 +8608,12 @@ impl<'a> Parser<'a> {
} else if self.parse_keywords(&[Keyword::CLUSTERING, Keyword::KEY]) {
AlterTableOperation::DropClusteringKey
} else {
let _ = self.parse_keyword(Keyword::COLUMN); // [ COLUMN ]
let has_column_keyword = self.parse_keyword(Keyword::COLUMN); // [ COLUMN ]
let if_exists = self.parse_keywords(&[Keyword::IF, Keyword::EXISTS]);
let column_name = self.parse_identifier()?;
let drop_behavior = self.parse_optional_drop_behavior();
AlterTableOperation::DropColumn {
has_column_keyword,
column_name,
if_exists,
drop_behavior,