mirror of
https://github.com/apache/datafusion-sqlparser-rs.git
synced 2025-07-07 17:04:59 +00:00
Add support for dropping multiple columns in Snowflake (#1918)
This commit is contained in:
parent
b0bcc46e22
commit
d2466af20a
7 changed files with 28 additions and 12 deletions
|
@ -4996,15 +4996,18 @@ fn parse_alter_table_drop_column() {
|
|||
"ALTER TABLE tab DROP is_active CASCADE",
|
||||
);
|
||||
|
||||
let dialects = all_dialects_where(|d| d.supports_comma_separated_drop_column_list());
|
||||
dialects.verified_stmt("ALTER TABLE tbl DROP COLUMN c1, c2, c3");
|
||||
|
||||
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,
|
||||
column_names,
|
||||
if_exists,
|
||||
drop_behavior,
|
||||
} => {
|
||||
assert_eq!("is_active", column_name.to_string());
|
||||
assert_eq!("is_active", column_names.first().unwrap().to_string());
|
||||
assert!(if_exists);
|
||||
match drop_behavior {
|
||||
None => assert!(constraint_text.ends_with(" is_active")),
|
||||
|
|
|
@ -2876,7 +2876,7 @@ fn parse_alter_table_with_algorithm() {
|
|||
vec![
|
||||
AlterTableOperation::DropColumn {
|
||||
has_column_keyword: true,
|
||||
column_name: Ident::new("password_digest"),
|
||||
column_names: vec![Ident::new("password_digest")],
|
||||
if_exists: false,
|
||||
drop_behavior: None,
|
||||
},
|
||||
|
@ -2924,7 +2924,7 @@ fn parse_alter_table_with_lock() {
|
|||
vec![
|
||||
AlterTableOperation::DropColumn {
|
||||
has_column_keyword: true,
|
||||
column_name: Ident::new("password_digest"),
|
||||
column_names: vec![Ident::new("password_digest")],
|
||||
if_exists: false,
|
||||
drop_behavior: None,
|
||||
},
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue