This is an automated email from the ASF dual-hosted git repository.
iffyio pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/datafusion-sqlparser-rs.git
The following commit(s) were added to refs/heads/main by this push:
new 7558d35c Snowflake: Support IDENTIFIER for GRANT ROLE (#1957)
7558d35c is described below
commit 7558d35c84d14f2b91b170a5b1eec8528b4965bb
Author: Yoav Cohen <[email protected]>
AuthorDate: Wed Jul 23 18:59:20 2025 +0300
Snowflake: Support IDENTIFIER for GRANT ROLE (#1957)
---
src/ast/mod.rs | 2 +-
src/parser/mod.rs | 2 +-
tests/sqlparser_common.rs | 2 ++
tests/sqlparser_snowflake.rs | 3 +++
4 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/src/ast/mod.rs b/src/ast/mod.rs
index e1646349..d8359136 100644
--- a/src/ast/mod.rs
+++ b/src/ast/mod.rs
@@ -6654,7 +6654,7 @@ pub enum Action {
Replicate,
ResolveAll,
Role {
- role: Ident,
+ role: ObjectName,
},
Select {
columns: Option<Vec<Ident>>,
diff --git a/src/parser/mod.rs b/src/parser/mod.rs
index 058423f1..a876d90e 100644
--- a/src/parser/mod.rs
+++ b/src/parser/mod.rs
@@ -14357,7 +14357,7 @@ impl<'a> Parser<'a> {
} else if self.parse_keyword(Keyword::REPLICATE) {
Ok(Action::Replicate)
} else if self.parse_keyword(Keyword::ROLE) {
- let role = self.parse_identifier()?;
+ let role = self.parse_object_name(false)?;
Ok(Action::Role { role })
} else if self.parse_keyword(Keyword::SELECT) {
Ok(Action::Select {
diff --git a/tests/sqlparser_common.rs b/tests/sqlparser_common.rs
index 074d9eab..add54a71 100644
--- a/tests/sqlparser_common.rs
+++ b/tests/sqlparser_common.rs
@@ -9549,6 +9549,8 @@ fn parse_grant() {
verified_stmt("GRANT SELECT ON FUTURE SEQUENCES IN SCHEMA db1.sc1 TO ROLE
role1");
verified_stmt("GRANT USAGE ON PROCEDURE db1.sc1.foo(INT) TO ROLE role1");
verified_stmt("GRANT USAGE ON FUNCTION db1.sc1.foo(INT) TO ROLE role1");
+ verified_stmt("GRANT ROLE role1 TO ROLE role2");
+ verified_stmt("GRANT ROLE role1 TO USER user");
}
#[test]
diff --git a/tests/sqlparser_snowflake.rs b/tests/sqlparser_snowflake.rs
index a7a63315..daa711d4 100644
--- a/tests/sqlparser_snowflake.rs
+++ b/tests/sqlparser_snowflake.rs
@@ -4500,4 +4500,7 @@ fn test_snowflake_identifier_function() {
.is_err(),
true
);
+
+ snowflake().verified_stmt("GRANT ROLE IDENTIFIER('AAA') TO USER
IDENTIFIER('AAA')");
+ snowflake().verified_stmt("REVOKE ROLE IDENTIFIER('AAA') FROM USER
IDENTIFIER('AAA')");
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]