Repository navigation
PostgreSQL: parse CREATE GROUP and DROP GROUP - #2429
LucaCappelletti94 wants to merge 4 commits into
Conversation
a81ad93 to
eb95863
Compare
eb95863 to
0dc690e
Compare
12418e2 to
bc8d980
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2429 +/- ##
==========================================
+ Coverage 81.28% 81.36% +0.07%
==========================================
Files 42 42
Lines 33920 34016 +96
Branches 33920 34016 +96
==========================================
+ Hits 27571 27676 +105
+ Misses 2785 2773 -12
- Partials 3564 3567 +3 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
f391d2c to
931d7f3
Compare
2ed5332 to
a99e919
Compare
a99e919 to
ddda956
Compare
sabir-akhadov-localstack
left a comment
There was a problem hiding this comment.
One non-blocking comment inline.
| &mut self, | ||
| role_keyword: RoleKeyword, | ||
| ) -> Result<CreateRole, ParserError> { | ||
| let if_not_exists = matches!(role_keyword, RoleKeyword::Role) |
There was a problem hiding this 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.
There was a problem hiding this comment.
Now it rejects consistently in both cases
PostgreSQL accepts
GROUPwherever it acceptsROLEin these two statements, but the parser rejected it, so a schema dump containingCREATE GROUPcould not be read at all.The keyword is preserved rather than rewritten to
ROLE. It looks like a pure alias in PostgreSQL, but Amazon Redshift has user groups as objects distinct from roles, so folding the two would change what the statement means there.I will also add
ALTER GROUPin a following PR, so as to keep this one smaller.