File tree Expand file tree Collapse file tree 4 files changed +21
-3
lines changed
Expand file tree Collapse file tree 4 files changed +21
-3
lines changed Original file line number Diff line number Diff line change @@ -3791,6 +3791,7 @@ pub enum Statement {
37913791 objects : Option < GrantObjects > ,
37923792 grantees : Vec < Grantee > ,
37933793 with_grant_option : bool ,
3794+ as_grantor : Option < Ident > ,
37943795 granted_by : Option < Ident > ,
37953796 } ,
37963797 /// ```sql
@@ -5413,6 +5414,7 @@ impl fmt::Display for Statement {
54135414 objects,
54145415 grantees,
54155416 with_grant_option,
5417+ as_grantor,
54165418 granted_by,
54175419 } => {
54185420 write ! ( f, "GRANT {privileges} " ) ?;
@@ -5423,6 +5425,9 @@ impl fmt::Display for Statement {
54235425 if * with_grant_option {
54245426 write ! ( f, " WITH GRANT OPTION" ) ?;
54255427 }
5428+ if let Some ( grantor) = as_grantor {
5429+ write ! ( f, " AS {grantor}" ) ?;
5430+ }
54265431 if let Some ( grantor) = granted_by {
54275432 write ! ( f, " GRANTED BY {grantor}" ) ?;
54285433 }
Original file line number Diff line number Diff line change @@ -12999,15 +12999,26 @@ impl<'a> Parser<'a> {
1299912999 let with_grant_option =
1300013000 self.parse_keywords(&[Keyword::WITH, Keyword::GRANT, Keyword::OPTION]);
1300113001
13002- let granted_by = self
13003- .parse_keywords(&[Keyword::GRANTED, Keyword::BY])
13004- .then(|| self.parse_identifier().unwrap());
13002+ let as_grantor = if self.peek_keyword(Keyword::AS) {
13003+ self.parse_keywords(&[Keyword::AS])
13004+ .then(|| self.parse_identifier().unwrap())
13005+ } else {
13006+ None
13007+ };
13008+
13009+ let granted_by = if self.peek_keywords(&[Keyword::GRANTED, Keyword::BY]) {
13010+ self.parse_keywords(&[Keyword::GRANTED, Keyword::BY])
13011+ .then(|| self.parse_identifier().unwrap())
13012+ } else {
13013+ None
13014+ };
1300513015
1300613016 Ok(Statement::Grant {
1300713017 privileges,
1300813018 objects,
1300913019 grantees,
1301013020 with_grant_option,
13021+ as_grantor,
1301113022 granted_by,
1301213023 })
1301313024 }
Original file line number Diff line number Diff line change @@ -9324,6 +9324,7 @@ fn parse_grant() {
93249324 verified_stmt("GRANT OWNERSHIP ON INTEGRATION int1 TO ROLE role1");
93259325 verified_stmt("GRANT SELECT ON VIEW view1 TO ROLE role1");
93269326 verified_stmt("GRANT EXEC ON my_sp TO runner");
9327+ verified_stmt("GRANT UPDATE ON my_table TO updater_role AS dbo");
93279328
93289329 all_dialects_where(|d| d.identifier_quote_style("none") == Some('['))
93299330 .verified_stmt("GRANT SELECT ON [my_table] TO [public]");
Original file line number Diff line number Diff line change @@ -3283,6 +3283,7 @@ fn parse_grant() {
32833283 objects,
32843284 grantees,
32853285 with_grant_option,
3286+ as_grantor : _,
32863287 granted_by,
32873288 } = stmt
32883289 {
You can’t perform that action at this time.
0 commit comments