Skip to content

PostgreSQL: Parse GRANT of role membership - #2732

Open
LucaCappelletti94 wants to merge 2 commits into
mainfrom
upstream/postgres-grant-role-membership
Open

LucaCappelletti94 wants to merge 2 commits into
mainfrom
upstream/postgres-grant-role-membership

Conversation

@LucaCappelletti94

Copy link
Copy Markdown
Contributor

GRANT bypasser TO anon failed with Expected: a privilege keyword, found: bypasser in every dialect, since GRANT only knew the privilege form. PostgreSQL grants membership in a role by naming the role without a keyword (GRANT).

The statement now parses into a new Statement::GrantRole, as the membership form shares neither the objects nor WITH GRANT OPTION with Grant. The privilege form is still tried first, and the role form takes over only when it fails on a role list followed by TO, so existing statements and their errors are unchanged. The WITH options and the matching REVOKE follow in separate PRs.

@codecov-commenter

codecov-commenter commented Oct 27, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 94.11765% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 82.37%. Comparing base (4c82c3a) to head (e3845d7).

Files with missing lines Patch % Lines
src/parser/mod.rs 94.28% 0 Missing and 2 partials ⚠️
src/ast/spans.rs 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2732      +/-   ##
==========================================
+ Coverage   82.34%   82.37%   +0.02%     
==========================================
  Files          42       42              
  Lines       35263    35313      +50     
  Branches    35263    35313      +50     
==========================================
+ Hits        29039    29089      +50     
- Misses       2677     2678       +1     
+ Partials     3547     3546       -1     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@LucaCappelletti94
LucaCappelletti94 force-pushed the upstream/postgres-grant-role-membership branch from 1be973d to e3845d7 Compare October 28, 2026 07:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request PostgreSQL

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants