Skip to content

Commit 02d60cc

Browse files
authored
Add support for USE SECONDARY ROLE (vs. ROLES) (apache#1637)
1 parent 8bc63f0 commit 02d60cc

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

src/parser/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10529,7 +10529,7 @@ impl<'a> Parser<'a> {
1052910529
}
1053010530

1053110531
fn parse_secondary_roles(&mut self) -> Result<Use, ParserError> {
10532-
self.expect_keyword_is(Keyword::ROLES)?;
10532+
self.expect_one_of_keywords(&[Keyword::ROLES, Keyword::ROLE])?;
1053310533
if self.parse_keyword(Keyword::NONE) {
1053410534
Ok(Use::SecondaryRoles(SecondaryRoles::None))
1053510535
} else if self.parse_keyword(Keyword::ALL) {

tests/sqlparser_snowflake.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2782,6 +2782,14 @@ fn parse_use() {
27822782
snowflake().verified_stmt("USE SECONDARY ROLES ALL");
27832783
snowflake().verified_stmt("USE SECONDARY ROLES NONE");
27842784
snowflake().verified_stmt("USE SECONDARY ROLES r1, r2, r3");
2785+
2786+
// The following is not documented by Snowflake but still works:
2787+
snowflake().one_statement_parses_to("USE SECONDARY ROLE ALL", "USE SECONDARY ROLES ALL");
2788+
snowflake().one_statement_parses_to("USE SECONDARY ROLE NONE", "USE SECONDARY ROLES NONE");
2789+
snowflake().one_statement_parses_to(
2790+
"USE SECONDARY ROLE r1, r2, r3",
2791+
"USE SECONDARY ROLES r1, r2, r3",
2792+
);
27852793
}
27862794

27872795
#[test]

0 commit comments

Comments
 (0)