Snowflake: Support IDENTIFIER for GRANT ROLE (#1957)
Some checks are pending
license / Release Audit Tool (RAT) (push) Waiting to run
Rust / test (stable) (push) Waiting to run
Rust / codestyle (push) Waiting to run
Rust / lint (push) Waiting to run
Rust / benchmark-lint (push) Waiting to run
Rust / compile (push) Waiting to run
Rust / docs (push) Waiting to run
Rust / compile-no-std (push) Waiting to run
Rust / test (beta) (push) Waiting to run
Rust / test (nightly) (push) Waiting to run

This commit is contained in:
Yoav Cohen 2025-07-23 18:59:20 +03:00 committed by GitHub
parent f49c30feb6
commit 7558d35c84
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 7 additions and 2 deletions

View file

@ -6654,7 +6654,7 @@ pub enum Action {
Replicate, Replicate,
ResolveAll, ResolveAll,
Role { Role {
role: Ident, role: ObjectName,
}, },
Select { Select {
columns: Option<Vec<Ident>>, columns: Option<Vec<Ident>>,

View file

@ -14357,7 +14357,7 @@ impl<'a> Parser<'a> {
} else if self.parse_keyword(Keyword::REPLICATE) { } else if self.parse_keyword(Keyword::REPLICATE) {
Ok(Action::Replicate) Ok(Action::Replicate)
} else if self.parse_keyword(Keyword::ROLE) { } else if self.parse_keyword(Keyword::ROLE) {
let role = self.parse_identifier()?; let role = self.parse_object_name(false)?;
Ok(Action::Role { role }) Ok(Action::Role { role })
} else if self.parse_keyword(Keyword::SELECT) { } else if self.parse_keyword(Keyword::SELECT) {
Ok(Action::Select { Ok(Action::Select {

View file

@ -9549,6 +9549,8 @@ fn parse_grant() {
verified_stmt("GRANT SELECT ON FUTURE SEQUENCES IN SCHEMA db1.sc1 TO ROLE role1"); 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 PROCEDURE db1.sc1.foo(INT) TO ROLE role1");
verified_stmt("GRANT USAGE ON FUNCTION 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] #[test]

View file

@ -4500,4 +4500,7 @@ fn test_snowflake_identifier_function() {
.is_err(), .is_err(),
true true
); );
snowflake().verified_stmt("GRANT ROLE IDENTIFIER('AAA') TO USER IDENTIFIER('AAA')");
snowflake().verified_stmt("REVOKE ROLE IDENTIFIER('AAA') FROM USER IDENTIFIER('AAA')");
} }