Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The ALTER ROLE syntax is not supported #941

Closed
6 of 7 tasks
r4ntix opened this issue Aug 8, 2023 · 0 comments · Fixed by #942
Closed
6 of 7 tasks

The ALTER ROLE syntax is not supported #941

r4ntix opened this issue Aug 8, 2023 · 0 comments · Fixed by #942

Comments

@r4ntix
Copy link
Contributor

r4ntix commented Aug 8, 2023

Background

The sqlparser-rs currently supported role syntax:

  • create role ✅
  • drop role ✅
  • set role ✅
  • alter role

Proposal

The syntax of PostgreSQL is as follows:

ALTER ROLE _`role_specification`_ [ WITH ] _`option`_ [ ... ]

where _`option`_ can be:

      SUPERUSER | NOSUPERUSER
    | CREATEDB | NOCREATEDB
    | CREATEROLE | NOCREATEROLE
    | INHERIT | NOINHERIT
    | LOGIN | NOLOGIN
    | REPLICATION | NOREPLICATION
    | BYPASSRLS | NOBYPASSRLS
    | CONNECTION LIMIT _`connlimit`_
    | [ ENCRYPTED ] PASSWORD '_`password`_' | PASSWORD NULL
    | VALID UNTIL '_`timestamp`_'

ALTER ROLE _`name`_ RENAME TO _`new_name`_

ALTER ROLE { _`role_specification`_ | ALL } [ IN DATABASE _`database_name`_ ] SET _`configuration_parameter`_ { TO | = } { _`value`_ | DEFAULT }
ALTER ROLE { _`role_specification`_ | ALL } [ IN DATABASE _`database_name`_ ] SET _`configuration_parameter`_ FROM CURRENT
ALTER ROLE { _`role_specification`_ | ALL } [ IN DATABASE _`database_name`_ ] RESET _`configuration_parameter`_
ALTER ROLE { _`role_specification`_ | ALL } [ IN DATABASE _`database_name`_ ] RESET ALL

where _`role_specification`_ can be:

    _`role_name`_
  | CURRENT_ROLE
  | CURRENT_USER
  | SESSION_USER

The syntax of MS SQL Server is as follows:

ALTER ROLE  role_name  
{  
       ADD MEMBER database_principal  
    |  DROP MEMBER database_principal  
    |  WITH NAME = new_name  
}  
[;]

Implementation Plan

  • add ALTER ROLE syntax of PostgreSQL ✅
  • add ALTER ROLE syntax of MS SQL Server ✅
  • add parser tests ✅

Addtional Context

Reference:

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 a pull request may close this issue.

1 participant