mirror of
https://github.com/apache/datafusion-sqlparser-rs.git
synced 2025-08-04 06:18:17 +00:00
Support parsing optional nulls handling for unique constraint (#1567)
This commit is contained in:
parent
6d4188de53
commit
6517da6b7d
6 changed files with 71 additions and 4 deletions
|
@ -594,6 +594,25 @@ fn parse_alter_table_constraints_rename() {
|
|||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn parse_alter_table_constraints_unique_nulls_distinct() {
|
||||
match pg_and_generic()
|
||||
.verified_stmt("ALTER TABLE t ADD CONSTRAINT b UNIQUE NULLS NOT DISTINCT (c)")
|
||||
{
|
||||
Statement::AlterTable { operations, .. } => match &operations[0] {
|
||||
AlterTableOperation::AddConstraint(TableConstraint::Unique {
|
||||
nulls_distinct, ..
|
||||
}) => {
|
||||
assert_eq!(nulls_distinct, &NullsDistinctOption::NotDistinct)
|
||||
}
|
||||
_ => unreachable!(),
|
||||
},
|
||||
_ => unreachable!(),
|
||||
}
|
||||
pg_and_generic().verified_stmt("ALTER TABLE t ADD CONSTRAINT b UNIQUE NULLS DISTINCT (c)");
|
||||
pg_and_generic().verified_stmt("ALTER TABLE t ADD CONSTRAINT b UNIQUE (c)");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn parse_alter_table_disable() {
|
||||
pg_and_generic().verified_stmt("ALTER TABLE tab DISABLE ROW LEVEL SECURITY");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue