Skip to content

Commit 799fced

Browse files
committed
Add support for the DROP privilege
1 parent 23f40cd commit 799fced

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
@@ -6587,6 +6587,7 @@ pub enum Action {
65876587
role: ObjectName,
65886588
},
65896589
Delete,
6590+
Drop,
65906591
EvolveSchema,
65916592
Exec {
65926593
obj_type: Option<ActionExecuteObjectType>,
@@ -6656,6 +6657,7 @@ impl fmt::Display for Action {
66566657
}
66576658
Action::DatabaseRole { role } => write!(f, "DATABASE ROLE {role}")?,
66586659
Action::Delete => f.write_str("DELETE")?,
6660+
Action::Drop => f.write_str("DROP")?,
66596661
Action::EvolveSchema => f.write_str("EVOLVE SCHEMA")?,
66606662
Action::Exec { obj_type } => {
66616663
f.write_str("EXEC")?;

src/parser/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14265,6 +14265,8 @@ impl<'a> Parser<'a> {
1426514265
Ok(Action::Usage)
1426614266
} else if self.parse_keyword(Keyword::OWNERSHIP) {
1426714267
Ok(Action::Ownership)
14268+
} else if self.parse_keyword(Keyword::DROP) {
14269+
Ok(Action::Drop)
1426814270
} else {
1426914271
self.expected("a privilege keyword", self.peek_token())?
1427014272
}

tests/sqlparser_common.rs

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

93189318
#[test]
93199319
fn parse_grant() {
9320-
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";
9320+
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";
93219321
match verified_stmt(sql) {
93229322
Statement::Grant {
93239323
privileges,
@@ -9355,6 +9355,7 @@ fn parse_grant() {
93559355
Action::Create { obj_type: None },
93569356
Action::Execute { obj_type: None },
93579357
Action::Temporary,
9358+
Action::Drop,
93589359
],
93599360
actions
93609361
);

0 commit comments

Comments
 (0)