You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@datafusion.apache.org by "LucaCappelletti94 (via GitHub)" <gi...@apache.org> on 2026/08/05 13:36:37 UTC

[PR] PostgreSQL: parse `CREATE GROUP` and `DROP GROUP` [datafusion-sqlparser-rs]

LucaCappelletti94 opened a new pull request, #2429:
URL: https://github.com/apache/datafusion-sqlparser-rs/pull/2429

   PostgreSQL accepts `GROUP` wherever it accepts `ROLE` in these two statements, but the parser rejected it, so a schema dump containing `CREATE GROUP` could 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 GROUP` in a following PR, so as to keep this one smaller.


-- 
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: github-unsubscribe@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org


Re: [PR] PostgreSQL: parse `CREATE GROUP` and `DROP GROUP` [datafusion-sqlparser-rs]

Posted by "sabir-akhadov-localstack (via GitHub)" <gi...@apache.org>.
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: github-unsubscribe@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org


Re: [PR] PostgreSQL: parse `CREATE GROUP` and `DROP GROUP` [datafusion-sqlparser-rs]

Posted by "codecov-commenter (via GitHub)" <gi...@apache.org>.
codecov-commenter commented on PR #2429:
URL: https://github.com/apache/datafusion-sqlparser-rs/pull/2429#issuecomment-5954014796

   ## [Codecov](https://app.codecov.io/gh/apache/datafusion-sqlparser-rs/pull/2429?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
   :white_check_mark: All modified and coverable lines are covered by tests.
   :white_check_mark: Project coverage is 81.18%. Comparing base ([`1ba145b`](https://app.codecov.io/gh/apache/datafusion-sqlparser-rs/commit/1ba145bd7defe37b25f374c9dcd479777e293437?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)) to head ([`3b95f95`](https://app.codecov.io/gh/apache/datafusion-sqlparser-rs/commit/3b95f958a5a3cf67fb616e4eeddd1bdc7315b86f?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)).
   
   <details><summary>Additional details and impacted files</summary>
   
   
   
   ```diff
   @@            Coverage Diff             @@
   ##             main    #2429      +/-   ##
   ==========================================
   + Coverage   81.14%   81.18%   +0.04%     
   ==========================================
     Files          42       42              
     Lines       33739    33763      +24     
     Branches    33739    33763      +24     
   ==========================================
   + Hits        27379    27412      +33     
   + Misses       2797     2785      -12     
   - Partials     3563     3566       +3     
   ```
   </details>
   
   [:umbrella: View full report in Codecov by Harness](https://app.codecov.io/gh/apache/datafusion-sqlparser-rs/pull/2429?dropdown=coverage&src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).   
   :loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
   <details><summary> :rocket: New features to boost your workflow: </summary>
   
   - :snowflake: [Test Analytics](https://docs.codecov.com/docs/test-analytics): Detect flaky tests, report on failures, and find test suite problems.
   </details>


-- 
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: github-unsubscribe@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org


Re: [PR] PostgreSQL: parse `CREATE GROUP` [datafusion-sqlparser-rs]

Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb merged PR #2429:
URL: https://github.com/apache/datafusion-sqlparser-rs/pull/2429


-- 
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: github-unsubscribe@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org


Re: [PR] PostgreSQL: parse `CREATE GROUP` and `DROP GROUP` [datafusion-sqlparser-rs]

Posted by "LucaCappelletti94 (via GitHub)" <gi...@apache.org>.
LucaCappelletti94 commented on code in PR #2429:
URL: https://github.com/apache/datafusion-sqlparser-rs/pull/2429#discussion_r4322933195


##########
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:
   Now it rejects consistently in both cases



-- 
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: github-unsubscribe@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org