Added support for DROP OPERATOR FAMILY (#2106)
Some checks failed
Rust / compile-no-std (push) Has been cancelled
license / Release Audit Tool (RAT) (push) Has been cancelled
Rust / codestyle (push) Has been cancelled
Rust / lint (push) Has been cancelled
Rust / benchmark-lint (push) Has been cancelled
Rust / compile (push) Has been cancelled
Rust / docs (push) Has been cancelled
Rust / test (beta) (push) Has been cancelled
Rust / test (nightly) (push) Has been cancelled
Rust / test (stable) (push) Has been cancelled

This commit is contained in:
Luca Cappelletti 2025-11-29 07:14:58 +01:00 committed by GitHub
parent 4beea9a4bc
commit 982f7669c2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 132 additions and 8 deletions

View file

@ -6910,6 +6910,61 @@ fn parse_drop_operator() {
);
}
#[test]
fn parse_drop_operator_family() {
for if_exists in [true, false] {
for drop_behavior in [
None,
Some(DropBehavior::Cascade),
Some(DropBehavior::Restrict),
] {
for index_method in &["btree", "hash", "gist", "gin", "spgist", "brin"] {
for (names_str, names_vec) in [
(
"float_ops",
vec![ObjectName::from(vec![Ident::new("float_ops")])],
),
(
"myschema.custom_ops",
vec![ObjectName::from(vec![
Ident::new("myschema"),
Ident::new("custom_ops"),
])],
),
(
"ops1, ops2, schema.ops3",
vec![
ObjectName::from(vec![Ident::new("ops1")]),
ObjectName::from(vec![Ident::new("ops2")]),
ObjectName::from(vec![Ident::new("schema"), Ident::new("ops3")]),
],
),
] {
let sql = format!(
"DROP OPERATOR FAMILY{} {} USING {}{}",
if if_exists { " IF EXISTS" } else { "" },
names_str,
index_method,
match drop_behavior {
Some(behavior) => format!(" {}", behavior),
None => String::new(),
}
);
assert_eq!(
pg_and_generic().verified_stmt(&sql),
Statement::DropOperatorFamily(DropOperatorFamily {
if_exists,
names: names_vec,
using: Ident::new(*index_method),
drop_behavior,
})
);
}
}
}
}
}
#[test]
fn parse_create_operator_family() {
for index_method in &["btree", "hash", "gist", "gin", "spgist", "brin"] {