Skip to content

Parse ALTER USER as a synonym for ALTER ROLE#3

Closed
LucaCappelletti94 wants to merge 1 commit into
mainfrom
pg-alter-user-as-alter-role
Closed

Parse ALTER USER as a synonym for ALTER ROLE#3
LucaCappelletti94 wants to merge 1 commit into
mainfrom
pg-alter-user-as-alter-role

Conversation

@LucaCappelletti94

Copy link
Copy Markdown
Owner

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

@LucaCappelletti94

Copy link
Copy Markdown
Owner Author

Wrong base repo, reopening against apache/datafusion-sqlparser-rs.

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.

1 participant