diff options
author | Peter Eisentraut <peter_e@gmx.net> | 2017-08-03 20:49:07 -0400 |
---|---|---|
committer | Peter Eisentraut <peter_e@gmx.net> | 2017-08-03 21:29:36 -0400 |
commit | b7d1bc820e191d8b56a35c8a8af409062c3a71be (patch) | |
tree | 607c1b486e4e54c9b3aca37f65a56ea067348b1b | |
parent | 035bb82222bc0518a740d02483395fafd333d426 (diff) | |
download | postgresql-b7d1bc820e191d8b56a35c8a8af409062c3a71be.tar.gz postgresql-b7d1bc820e191d8b56a35c8a8af409062c3a71be.zip |
Add missing ALTER USER variants
ALTER USER ... SET did not support all the syntax variants of ALTER ROLE
... SET.
Reported-by: Pavel Golub <pavel@microolap.com>
-rw-r--r-- | doc/src/sgml/ref/alter_role.sgml | 2 | ||||
-rw-r--r-- | doc/src/sgml/ref/alter_user.sgml | 8 | ||||
-rw-r--r-- | src/backend/parser/gram.y | 14 |
3 files changed, 16 insertions, 8 deletions
diff --git a/doc/src/sgml/ref/alter_role.sgml b/doc/src/sgml/ref/alter_role.sgml index b0981fdd5d5..e4428fc9396 100644 --- a/doc/src/sgml/ref/alter_role.sgml +++ b/doc/src/sgml/ref/alter_role.sgml @@ -38,7 +38,7 @@ ALTER ROLE <replaceable class="PARAMETER">name</replaceable> [ [ WITH ] <replace ALTER ROLE <replaceable class="PARAMETER">name</replaceable> RENAME TO <replaceable>new_name</replaceable> -ALTER ROLE <replaceable class="PARAMETER">name</replaceable> [ IN DATABASE <replaceable class="PARAMETER">database_name</replaceable> ] SET <replaceable>configuration_parameter</replaceable> { TO | = } { <replaceable>value</replaceable> | DEFAULT } +ALTER ROLE { <replaceable class="PARAMETER">name</replaceable> | ALL } [ IN DATABASE <replaceable class="PARAMETER">database_name</replaceable> ] SET <replaceable>configuration_parameter</replaceable> { TO | = } { <replaceable>value</replaceable> | DEFAULT } ALTER ROLE { <replaceable class="PARAMETER">name</replaceable> | ALL } [ IN DATABASE <replaceable class="PARAMETER">database_name</replaceable> ] SET <replaceable>configuration_parameter</replaceable> FROM CURRENT ALTER ROLE { <replaceable class="PARAMETER">name</replaceable> | ALL } [ IN DATABASE <replaceable class="PARAMETER">database_name</replaceable> ] RESET <replaceable>configuration_parameter</replaceable> ALTER ROLE { <replaceable class="PARAMETER">name</replaceable> | ALL } [ IN DATABASE <replaceable class="PARAMETER">database_name</replaceable> ] RESET ALL diff --git a/doc/src/sgml/ref/alter_user.sgml b/doc/src/sgml/ref/alter_user.sgml index 7588f636ed2..2302ce3a65c 100644 --- a/doc/src/sgml/ref/alter_user.sgml +++ b/doc/src/sgml/ref/alter_user.sgml @@ -38,10 +38,10 @@ ALTER USER <replaceable class="PARAMETER">name</replaceable> [ [ WITH ] <replace ALTER USER <replaceable class="PARAMETER">name</replaceable> RENAME TO <replaceable>new_name</replaceable> -ALTER USER <replaceable class="PARAMETER">name</replaceable> SET <replaceable>configuration_parameter</replaceable> { TO | = } { <replaceable>value</replaceable> | DEFAULT } -ALTER USER <replaceable class="PARAMETER">name</replaceable> SET <replaceable>configuration_parameter</replaceable> FROM CURRENT -ALTER USER <replaceable class="PARAMETER">name</replaceable> RESET <replaceable>configuration_parameter</replaceable> -ALTER USER <replaceable class="PARAMETER">name</replaceable> RESET ALL +ALTER USER { <replaceable class="PARAMETER">name</replaceable> | ALL } [ IN DATABASE <replaceable class="PARAMETER">database_name</replaceable> ] SET <replaceable>configuration_parameter</replaceable> { TO | = } { <replaceable>value</replaceable> | DEFAULT } +ALTER USER { <replaceable class="PARAMETER">name</replaceable> | ALL } [ IN DATABASE <replaceable class="PARAMETER">database_name</replaceable> ] SET <replaceable>configuration_parameter</replaceable> FROM CURRENT +ALTER USER { <replaceable class="PARAMETER">name</replaceable> | ALL } [ IN DATABASE <replaceable class="PARAMETER">database_name</replaceable> ] RESET <replaceable>configuration_parameter</replaceable> +ALTER USER { <replaceable class="PARAMETER">name</replaceable> | ALL } [ IN DATABASE <replaceable class="PARAMETER">database_name</replaceable> ] RESET ALL </synopsis> </refsynopsisdiv> diff --git a/src/backend/parser/gram.y b/src/backend/parser/gram.y index f8bb66501ad..563dc91a869 100644 --- a/src/backend/parser/gram.y +++ b/src/backend/parser/gram.y @@ -1049,12 +1049,20 @@ AlterUserStmt: AlterUserSetStmt: - ALTER USER RoleId SetResetClause + ALTER USER RoleId opt_in_database SetResetClause { AlterRoleSetStmt *n = makeNode(AlterRoleSetStmt); n->role = $3; - n->database = NULL; - n->setstmt = $4; + n->database = $4; + n->setstmt = $5; + $$ = (Node *)n; + } + | ALTER USER ALL opt_in_database SetResetClause + { + AlterRoleSetStmt *n = makeNode(AlterRoleSetStmt); + n->role = NULL; + n->database = $4; + n->setstmt = $5; $$ = (Node *)n; } ; |