mirror of
https://github.com/apache/datafusion-sqlparser-rs.git
synced 2025-07-08 01:15:00 +00:00
Add support for USE SECONDARY ROLE (vs. ROLES) (#1637)
This commit is contained in:
parent
8bc63f0e4a
commit
02d60cc0fc
2 changed files with 9 additions and 1 deletions
|
@ -10529,7 +10529,7 @@ impl<'a> Parser<'a> {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn parse_secondary_roles(&mut self) -> Result<Use, ParserError> {
|
fn parse_secondary_roles(&mut self) -> Result<Use, ParserError> {
|
||||||
self.expect_keyword_is(Keyword::ROLES)?;
|
self.expect_one_of_keywords(&[Keyword::ROLES, Keyword::ROLE])?;
|
||||||
if self.parse_keyword(Keyword::NONE) {
|
if self.parse_keyword(Keyword::NONE) {
|
||||||
Ok(Use::SecondaryRoles(SecondaryRoles::None))
|
Ok(Use::SecondaryRoles(SecondaryRoles::None))
|
||||||
} else if self.parse_keyword(Keyword::ALL) {
|
} else if self.parse_keyword(Keyword::ALL) {
|
||||||
|
|
|
@ -2782,6 +2782,14 @@ fn parse_use() {
|
||||||
snowflake().verified_stmt("USE SECONDARY ROLES ALL");
|
snowflake().verified_stmt("USE SECONDARY ROLES ALL");
|
||||||
snowflake().verified_stmt("USE SECONDARY ROLES NONE");
|
snowflake().verified_stmt("USE SECONDARY ROLES NONE");
|
||||||
snowflake().verified_stmt("USE SECONDARY ROLES r1, r2, r3");
|
snowflake().verified_stmt("USE SECONDARY ROLES r1, r2, r3");
|
||||||
|
|
||||||
|
// The following is not documented by Snowflake but still works:
|
||||||
|
snowflake().one_statement_parses_to("USE SECONDARY ROLE ALL", "USE SECONDARY ROLES ALL");
|
||||||
|
snowflake().one_statement_parses_to("USE SECONDARY ROLE NONE", "USE SECONDARY ROLES NONE");
|
||||||
|
snowflake().one_statement_parses_to(
|
||||||
|
"USE SECONDARY ROLE r1, r2, r3",
|
||||||
|
"USE SECONDARY ROLES r1, r2, r3",
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue