Skip to content

Commit 7ad30fc

Browse files
committed
Snowflake: Support IDENTIFIER for GRANT ROLE
1 parent 40bbcc9 commit 7ad30fc

File tree

4 files changed

+7
-2
lines changed

4 files changed

+7
-2
lines changed

src/ast/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6623,7 +6623,7 @@ pub enum Action {
66236623
Replicate,
66246624
ResolveAll,
66256625
Role {
6626-
role: Ident,
6626+
role: ObjectName,
66276627
},
66286628
Select {
66296629
columns: Option<Vec<Ident>>,

src/parser/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14237,7 +14237,7 @@ impl<'a> Parser<'a> {
1423714237
} else if self.parse_keyword(Keyword::REPLICATE) {
1423814238
Ok(Action::Replicate)
1423914239
} else if self.parse_keyword(Keyword::ROLE) {
14240-
let role = self.parse_identifier()?;
14240+
let role = self.parse_object_name(false)?;
1424114241
Ok(Action::Role { role })
1424214242
} else if self.parse_keyword(Keyword::SELECT) {
1424314243
Ok(Action::Select {

tests/sqlparser_common.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9484,6 +9484,8 @@ fn parse_grant() {
94849484
verified_stmt("GRANT SELECT ON FUTURE SEQUENCES IN SCHEMA db1.sc1 TO ROLE role1");
94859485
verified_stmt("GRANT USAGE ON PROCEDURE db1.sc1.foo(INT) TO ROLE role1");
94869486
verified_stmt("GRANT USAGE ON FUNCTION db1.sc1.foo(INT) TO ROLE role1");
9487+
verified_stmt("GRANT ROLE role1 TO ROLE role2");
9488+
verified_stmt("GRANT ROLE role1 TO USER user");
94879489
}
94889490

94899491
#[test]

tests/sqlparser_snowflake.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4500,4 +4500,7 @@ fn test_snowflake_identifier_function() {
45004500
.is_err(),
45014501
true
45024502
);
4503+
4504+
snowflake().verified_stmt("GRANT ROLE IDENTIFIER('AAA') TO USER IDENTIFIER('AAA')");
4505+
snowflake().verified_stmt("REVOKE ROLE IDENTIFIER('AAA') FROM USER IDENTIFIER('AAA')");
45034506
}

0 commit comments

Comments
 (0)