Skip to content

Remove role memberships on REVOKE role FROM grantee - #175

Merged
LucaCappelletti94 merged 3 commits into
mainfrom
upstream/revoke-role-membership
Oct 28, 2026
Merged

LucaCappelletti94 merged 3 commits into
mainfrom
upstream/revoke-role-membership

Conversation

@LucaCappelletti94

Copy link
Copy Markdown
Contributor

sqlparser now parses REVOKE role FROM grantee as its own statement (apache/datafusion-sqlparser-rs#2735). sql-traits had no arm for it, so a membership that was granted and later revoked stayed in the catalog. A consumer such as pg2sqlite would then let the member inherit a role that PostgreSQL had taken away.

The revoke follows PostgreSQL's own planning in user.c, and each case was compared against a PostgreSQL 18 server. It removes the grant made by the named grantor, or the grant written without one, and OPTION FOR clears only that option. A revoke that reaches no grant changes nothing, because PostgreSQL only warns. Grants a member made with its ADMIN option depend on that option, so taking away its last one is refused unless CASCADE revokes those grants as well. The grantors the model already records make this possible.

The first commit moves the locked sqlparser to the revision that carries apache/datafusion-sqlparser-rs#2735.

@codecov

codecov Bot commented Oct 28, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@LucaCappelletti94
LucaCappelletti94 merged commit 8955859 into main Oct 28, 2026
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant