Skip to content

Commit d346d2a

Browse files
committed
Add support for EXEC privilege type
1 parent 8bdc77d commit d346d2a

File tree

3 files changed

+14
-0
lines changed

3 files changed

+14
-0
lines changed

src/ast/mod.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6385,6 +6385,9 @@ pub enum Action {
63856385
},
63866386
Delete,
63876387
EvolveSchema,
6388+
Exec {
6389+
obj_type: Option<ActionExecuteObjectType>,
6390+
},
63886391
Execute {
63896392
obj_type: Option<ActionExecuteObjectType>,
63906393
},
@@ -6451,6 +6454,12 @@ impl fmt::Display for Action {
64516454
Action::DatabaseRole { role } => write!(f, "DATABASE ROLE {role}")?,
64526455
Action::Delete => f.write_str("DELETE")?,
64536456
Action::EvolveSchema => f.write_str("EVOLVE SCHEMA")?,
6457+
Action::Exec { obj_type } => {
6458+
f.write_str("EXEC")?;
6459+
if let Some(obj_type) = obj_type {
6460+
write!(f, " {obj_type}")?
6461+
}
6462+
}
64546463
Action::Execute { obj_type } => {
64556464
f.write_str("EXECUTE")?;
64566465
if let Some(obj_type) = obj_type {

src/parser/mod.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13608,6 +13608,9 @@ impl<'a> Parser<'a> {
1360813608
Ok(Action::Create { obj_type })
1360913609
} else if self.parse_keyword(Keyword::DELETE) {
1361013610
Ok(Action::Delete)
13611+
} else if self.parse_keyword(Keyword::EXEC) {
13612+
let obj_type = self.maybe_parse_action_execute_obj_type();
13613+
Ok(Action::Exec { obj_type })
1361113614
} else if self.parse_keyword(Keyword::EXECUTE) {
1361213615
let obj_type = self.maybe_parse_action_execute_obj_type();
1361313616
Ok(Action::Execute { obj_type })

tests/sqlparser_common.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9331,6 +9331,7 @@ fn parse_grant() {
93319331
verified_stmt("GRANT USAGE ON WAREHOUSE wh1 TO ROLE role1");
93329332
verified_stmt("GRANT OWNERSHIP ON INTEGRATION int1 TO ROLE role1");
93339333
verified_stmt("GRANT SELECT ON VIEW view1 TO ROLE role1");
9334+
verified_stmt("GRANT EXEC ON my_sp TO runner");
93349335

93359336
all_dialects_where(|d| d.identifier_quote_style("none") == Some('['))
93369337
.verified_stmt("GRANT SELECT ON [my_table] TO [public]");
@@ -9358,6 +9359,7 @@ fn parse_deny() {
93589359

93599360
verified_stmt("DENY SELECT, INSERT, UPDATE, DELETE ON db1.sc1 TO role1, role2");
93609361
verified_stmt("DENY ALL ON db1.sc1 TO role1");
9362+
verified_stmt("DENY EXEC ON my_sp TO runner");
93619363

93629364
all_dialects_where(|d| d.identifier_quote_style("none") == Some('['))
93639365
.verified_stmt("DENY SELECT ON [my_table] TO [public]");

0 commit comments

Comments
 (0)