Add support for GRANT DROP statement (#1959)
Some checks failed
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 / compile-no-std (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:
Yoav Cohen 2025-07-21 14:43:29 +03:00 committed by GitHub
parent 799c1f748d
commit 492184643a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 6 additions and 1 deletions

View file

@ -6611,6 +6611,7 @@ pub enum Action {
role: ObjectName,
},
Delete,
Drop,
EvolveSchema,
Exec {
obj_type: Option<ActionExecuteObjectType>,
@ -6680,6 +6681,7 @@ impl fmt::Display for Action {
}
Action::DatabaseRole { role } => write!(f, "DATABASE ROLE {role}")?,
Action::Delete => f.write_str("DELETE")?,
Action::Drop => f.write_str("DROP")?,
Action::EvolveSchema => f.write_str("EVOLVE SCHEMA")?,
Action::Exec { obj_type } => {
f.write_str("EXEC")?;

View file

@ -14339,6 +14339,8 @@ impl<'a> Parser<'a> {
Ok(Action::Usage)
} else if self.parse_keyword(Keyword::OWNERSHIP) {
Ok(Action::Ownership)
} else if self.parse_keyword(Keyword::DROP) {
Ok(Action::Drop)
} else {
self.expected("a privilege keyword", self.peek_token())?
}

View file

@ -9342,7 +9342,7 @@ fn parse_drop_role() {
#[test]
fn parse_grant() {
let sql = "GRANT SELECT, INSERT, UPDATE (shape, size), USAGE, DELETE, TRUNCATE, REFERENCES, TRIGGER, CONNECT, CREATE, EXECUTE, TEMPORARY ON abc, def TO xyz, m WITH GRANT OPTION GRANTED BY jj";
let sql = "GRANT SELECT, INSERT, UPDATE (shape, size), USAGE, DELETE, TRUNCATE, REFERENCES, TRIGGER, CONNECT, CREATE, EXECUTE, TEMPORARY, DROP ON abc, def TO xyz, m WITH GRANT OPTION GRANTED BY jj";
match verified_stmt(sql) {
Statement::Grant {
privileges,
@ -9380,6 +9380,7 @@ fn parse_grant() {
Action::Create { obj_type: None },
Action::Execute { obj_type: None },
Action::Temporary,
Action::Drop,
],
actions
);