Skip to content

Commit 4921846

Browse files
authored
Add support for GRANT DROP statement (#1959)
1 parent 799c1f7 commit 4921846

File tree

3 files changed

+6
-1
lines changed

3 files changed

+6
-1
lines changed

src/ast/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6611,6 +6611,7 @@ pub enum Action {
66116611
role: ObjectName,
66126612
},
66136613
Delete,
6614+
Drop,
66146615
EvolveSchema,
66156616
Exec {
66166617
obj_type: Option<ActionExecuteObjectType>,
@@ -6680,6 +6681,7 @@ impl fmt::Display for Action {
66806681
}
66816682
Action::DatabaseRole { role } => write!(f, "DATABASE ROLE {role}")?,
66826683
Action::Delete => f.write_str("DELETE")?,
6684+
Action::Drop => f.write_str("DROP")?,
66836685
Action::EvolveSchema => f.write_str("EVOLVE SCHEMA")?,
66846686
Action::Exec { obj_type } => {
66856687
f.write_str("EXEC")?;

src/parser/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14339,6 +14339,8 @@ impl<'a> Parser<'a> {
1433914339
Ok(Action::Usage)
1434014340
} else if self.parse_keyword(Keyword::OWNERSHIP) {
1434114341
Ok(Action::Ownership)
14342+
} else if self.parse_keyword(Keyword::DROP) {
14343+
Ok(Action::Drop)
1434214344
} else {
1434314345
self.expected("a privilege keyword", self.peek_token())?
1434414346
}

tests/sqlparser_common.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9342,7 +9342,7 @@ fn parse_drop_role() {
93429342

93439343
#[test]
93449344
fn parse_grant() {
9345-
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";
9345+
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";
93469346
match verified_stmt(sql) {
93479347
Statement::Grant {
93489348
privileges,
@@ -9380,6 +9380,7 @@ fn parse_grant() {
93809380
Action::Create { obj_type: None },
93819381
Action::Execute { obj_type: None },
93829382
Action::Temporary,
9383+
Action::Drop,
93839384
],
93849385
actions
93859386
);

0 commit comments

Comments
 (0)