sabir-akhadov-localstack commented on code in PR #2429:
URL:
https://github.com/apache/datafusion-sqlparser-rs/pull/2429#discussion_r4317930622
##########
src/parser/mod.rs:
##########
@@ -7028,9 +7032,13 @@ impl<'a> Parser<'a> {
}
}
- /// Parse a `CREATE ROLE` statement.
- pub fn parse_create_role(&mut self) -> Result<CreateRole, ParserError> {
- let if_not_exists = self.parse_keywords(&[Keyword::IF, Keyword::NOT,
Keyword::EXISTS]);
+ /// Parse a `CREATE ROLE` or `CREATE GROUP` statement, after the keyword
has been consumed.
+ pub fn parse_create_role(
+ &mut self,
+ role_keyword: RoleKeyword,
+ ) -> Result<CreateRole, ParserError> {
+ let if_not_exists = matches!(role_keyword, RoleKeyword::Role)
Review Comment:
PostgreSQL rejects `IF NOT EXISTS` for `CREATE ROLE` too, so this guard only
makes the two spellings diverge: `CREATE GROUP IF NOT EXISTS g` now takes `IF`
as the group name and fails with `Expected: end of statement, found: NOT`.
Either drop the guard to keep parity with `ROLE`, or reject it with an explicit
error.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]