Skip to content

Commit c66366b

Browse files
yoavcloudayman-sigma
authored andcommitted
Add support for GRANT DROP statement (apache#1959)
1 parent 130f3fe commit c66366b

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
@@ -6640,6 +6640,7 @@ pub enum Action {
66406640
role: ObjectName,
66416641
},
66426642
Delete,
6643+
Drop,
66436644
EvolveSchema,
66446645
Exec {
66456646
obj_type: Option<ActionExecuteObjectType>,
@@ -6709,6 +6710,7 @@ impl fmt::Display for Action {
67096710
}
67106711
Action::DatabaseRole { role } => write!(f, "DATABASE ROLE {role}")?,
67116712
Action::Delete => f.write_str("DELETE")?,
6713+
Action::Drop => f.write_str("DROP")?,
67126714
Action::EvolveSchema => f.write_str("EVOLVE SCHEMA")?,
67136715
Action::Exec { obj_type } => {
67146716
f.write_str("EXEC")?;

src/parser/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14371,6 +14371,8 @@ impl<'a> Parser<'a> {
1437114371
Ok(Action::Usage)
1437214372
} else if self.parse_keyword(Keyword::OWNERSHIP) {
1437314373
Ok(Action::Ownership)
14374+
} else if self.parse_keyword(Keyword::DROP) {
14375+
Ok(Action::Drop)
1437414376
} else {
1437514377
self.expected("a privilege keyword", self.peek_token())?
1437614378
}

tests/sqlparser_common.rs

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

93449344
#[test]
93459345
fn parse_grant() {
9346-
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";
9346+
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";
93479347
match verified_stmt(sql) {
93489348
Statement::Grant {
93499349
privileges,
@@ -9381,6 +9381,7 @@ fn parse_grant() {
93819381
Action::Create { obj_type: None },
93829382
Action::Execute { obj_type: None },
93839383
Action::Temporary,
9384+
Action::Drop,
93849385
],
93859386
actions
93869387
);

0 commit comments

Comments
 (0)