Skip to content

Parse ALTER USER as a synonym for ALTER ROLE#2374

Merged
iffyio merged 4 commits into
apache:mainfrom
LucaCappelletti94:pg-alter-user-as-alter-role
Jun 20, 2026
Merged

Parse ALTER USER as a synonym for ALTER ROLE#2374
iffyio merged 4 commits into
apache:mainfrom
LucaCappelletti94:pg-alter-user-as-alter-role

Conversation

@LucaCappelletti94

Copy link
Copy Markdown
Contributor

In PostgreSQL, ALTER USER is an alternate spelling of ALTER ROLE and accepts the same option syntax (WITH SUPERUSER, PASSWORD '...', CONNECTION LIMIT n, RENAME TO ..., SET/RESET parameter, etc.). The parser previously routed every dialect's ALTER USER to the Snowflake-specific parse_alter_user, which rejected all of these PostgreSQL forms.

This adds a supports_alter_user_as_alter_role dialect hook (default false, true for PostgreSQL). When set, ALTER USER dispatches to the existing parse_alter_role path and produces a Statement::AlterRole, since the two are semantically identical in PostgreSQL. All other dialects keep the Snowflake behavior unchanged. The shared Snowflake ALTER USER test is scoped to dialects that do not enable the new hook.

Reference: https://www.postgresql.org/docs/current/sql-alteruser.html

@iffyio iffyio left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thanks @LucaCappelletti94!

@iffyio iffyio added this pull request to the merge queue Jun 17, 2026
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Jun 17, 2026
@LucaCappelletti94 LucaCappelletti94 requested a review from iffyio June 19, 2026 20:53
@iffyio iffyio added this pull request to the merge queue Jun 20, 2026
Merged via the queue into apache:main with commit e79119c Jun 20, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants