Skip to content

Commit b323f52

Browse files
committed
Add support for EXEC privilege type
1 parent c34205b commit b323f52

File tree

3 files changed

+14
-0
lines changed

3 files changed

+14
-0
lines changed

src/ast/mod.rs

+9
Original file line numberDiff line numberDiff line change
@@ -6192,6 +6192,9 @@ pub enum Action {
61926192
},
61936193
Delete,
61946194
EvolveSchema,
6195+
Exec {
6196+
obj_type: Option<ActionExecuteObjectType>,
6197+
},
61956198
Execute {
61966199
obj_type: Option<ActionExecuteObjectType>,
61976200
},
@@ -6258,6 +6261,12 @@ impl fmt::Display for Action {
62586261
Action::DatabaseRole { role } => write!(f, "DATABASE ROLE {role}")?,
62596262
Action::Delete => f.write_str("DELETE")?,
62606263
Action::EvolveSchema => f.write_str("EVOLVE SCHEMA")?,
6264+
Action::Exec { obj_type } => {
6265+
f.write_str("EXEC")?;
6266+
if let Some(obj_type) = obj_type {
6267+
write!(f, " {obj_type}")?
6268+
}
6269+
}
62616270
Action::Execute { obj_type } => {
62626271
f.write_str("EXECUTE")?;
62636272
if let Some(obj_type) = obj_type {

src/parser/mod.rs

+3
Original file line numberDiff line numberDiff line change
@@ -13214,6 +13214,9 @@ impl<'a> Parser<'a> {
1321413214
Ok(Action::Create { obj_type })
1321513215
} else if self.parse_keyword(Keyword::DELETE) {
1321613216
Ok(Action::Delete)
13217+
} else if self.parse_keyword(Keyword::EXEC) {
13218+
let obj_type = self.maybe_parse_action_execute_obj_type();
13219+
Ok(Action::Exec { obj_type })
1321713220
} else if self.parse_keyword(Keyword::EXECUTE) {
1321813221
let obj_type = self.maybe_parse_action_execute_obj_type();
1321913222
Ok(Action::Execute { obj_type })

tests/sqlparser_common.rs

+2
Original file line numberDiff line numberDiff line change
@@ -9323,6 +9323,7 @@ fn parse_grant() {
93239323
verified_stmt("GRANT USAGE ON WAREHOUSE wh1 TO ROLE role1");
93249324
verified_stmt("GRANT OWNERSHIP ON INTEGRATION int1 TO ROLE role1");
93259325
verified_stmt("GRANT SELECT ON VIEW view1 TO ROLE role1");
9326+
verified_stmt("GRANT EXEC ON my_sp TO runner");
93269327

93279328
all_dialects_where(|d| d.identifier_quote_style("none") == Some('['))
93289329
.verified_stmt("GRANT SELECT ON [my_table] TO [public]");
@@ -9350,6 +9351,7 @@ fn parse_deny() {
93509351

93519352
verified_stmt("DENY SELECT, INSERT, UPDATE, DELETE ON db1.sc1 TO role1");
93529353
verified_stmt("DENY ALL ON db1.sc1 TO role1");
9354+
verified_stmt("DENY EXEC ON my_sp TO runner");
93539355

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

0 commit comments

Comments
 (0)