mirror of
https://github.com/apache/datafusion-sqlparser-rs.git
synced 2025-08-04 14:28:22 +00:00
Keep the COLUMN keyword only if it exists when dropping the column (#1862)
This commit is contained in:
parent
301726541a
commit
9159d08c5e
5 changed files with 12 additions and 4 deletions
|
@ -4926,17 +4926,18 @@ fn parse_alter_table_drop_column() {
|
|||
check_one("DROP COLUMN IF EXISTS is_active CASCADE");
|
||||
check_one("DROP COLUMN IF EXISTS is_active RESTRICT");
|
||||
one_statement_parses_to(
|
||||
"ALTER TABLE tab DROP IF EXISTS is_active CASCADE",
|
||||
"ALTER TABLE tab DROP COLUMN IF EXISTS is_active CASCADE",
|
||||
"ALTER TABLE tab DROP COLUMN IF EXISTS is_active CASCADE",
|
||||
);
|
||||
one_statement_parses_to(
|
||||
"ALTER TABLE tab DROP is_active CASCADE",
|
||||
"ALTER TABLE tab DROP COLUMN is_active CASCADE",
|
||||
"ALTER TABLE tab DROP is_active CASCADE",
|
||||
);
|
||||
|
||||
fn check_one(constraint_text: &str) {
|
||||
match alter_table_op(verified_stmt(&format!("ALTER TABLE tab {constraint_text}"))) {
|
||||
AlterTableOperation::DropColumn {
|
||||
has_column_keyword: true,
|
||||
column_name,
|
||||
if_exists,
|
||||
drop_behavior,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue