mirror of
https://github.com/apache/datafusion-sqlparser-rs.git
synced 2025-07-09 18:04:59 +00:00
Add support for ENABLE and DISABLE on ALTER TABLE for pg (#1077)
Signed-off-by: Toby Hede <toby@cipherstash.com>
This commit is contained in:
parent
593c090b21
commit
a75778c8c7
7 changed files with 143 additions and 7 deletions
|
@ -563,6 +563,27 @@ fn parse_alter_table_constraints_rename() {
|
|||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn parse_alter_table_disable() {
|
||||
pg_and_generic().verified_stmt("ALTER TABLE tab DISABLE ROW LEVEL SECURITY");
|
||||
pg_and_generic().verified_stmt("ALTER TABLE tab DISABLE RULE rule_name");
|
||||
pg_and_generic().verified_stmt("ALTER TABLE tab DISABLE TRIGGER ALL");
|
||||
pg_and_generic().verified_stmt("ALTER TABLE tab DISABLE TRIGGER USER");
|
||||
pg_and_generic().verified_stmt("ALTER TABLE tab DISABLE TRIGGER trigger_name");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn parse_alter_table_enable() {
|
||||
pg_and_generic().verified_stmt("ALTER TABLE tab ENABLE ALWAYS RULE rule_name");
|
||||
pg_and_generic().verified_stmt("ALTER TABLE tab ENABLE ALWAYS TRIGGER trigger_name");
|
||||
pg_and_generic().verified_stmt("ALTER TABLE tab ENABLE REPLICA TRIGGER trigger_name");
|
||||
pg_and_generic().verified_stmt("ALTER TABLE tab ENABLE REPLICA RULE rule_name");
|
||||
pg_and_generic().verified_stmt("ALTER TABLE tab ENABLE ROW LEVEL SECURITY");
|
||||
pg_and_generic().verified_stmt("ALTER TABLE tab ENABLE RULE rule_name");
|
||||
pg_and_generic().verified_stmt("ALTER TABLE tab ENABLE TRIGGER ALL");
|
||||
pg_and_generic().verified_stmt("ALTER TABLE tab ENABLE TRIGGER USER");
|
||||
pg_and_generic().verified_stmt("ALTER TABLE tab ENABLE TRIGGER trigger_name");
|
||||
}
|
||||
#[test]
|
||||
fn parse_alter_table_alter_column() {
|
||||
pg().one_statement_parses_to(
|
||||
|
@ -3256,7 +3277,7 @@ fn parse_dollar_quoted_string() {
|
|||
|
||||
let stmt = pg().parse_sql_statements(sql).unwrap();
|
||||
|
||||
let projection = match stmt.get(0).unwrap() {
|
||||
let projection = match stmt.first().unwrap() {
|
||||
Statement::Query(query) => match &*query.body {
|
||||
SetExpr::Select(select) => &select.projection,
|
||||
_ => unreachable!(),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue