1
0
mirror of https://github.com/postgres/postgres.git synced 2025-09-02 04:21:28 +03:00

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>
This commit is contained in:
Peter Eisentraut
2017-08-03 20:49:07 -04:00
parent 3d76328298
commit df04db0413
3 changed files with 17 additions and 15 deletions

View File

@@ -1111,12 +1111,20 @@ AlterUserStmt:
AlterUserSetStmt:
ALTER USER RoleSpec SetResetClause
ALTER USER RoleSpec 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;
}
;

View File

@@ -310,9 +310,9 @@ ERROR: syntax error at or near "CURRENT_ROLE"
LINE 1: ALTER USER CURRENT_ROLE WITH LOGIN;
^
ALTER USER ALL WITH REPLICATION; -- error
ERROR: syntax error at or near "ALL"
ERROR: syntax error at or near "WITH"
LINE 1: ALTER USER ALL WITH REPLICATION;
^
^
ALTER USER SESSION_ROLE WITH NOREPLICATION; -- error
ERROR: role "session_role" does not exist
ALTER USER PUBLIC WITH NOREPLICATION; -- error
@@ -392,9 +392,6 @@ ALTER USER SESSION_USER SET application_name to 'BAR';
ALTER USER "current_user" SET application_name to 'FOOFOO';
ALTER USER "Public" SET application_name to 'BARBAR';
ALTER USER ALL SET application_name to 'SLAP';
ERROR: syntax error at or near "ALL"
LINE 1: ALTER USER ALL SET application_name to 'SLAP';
^
SELECT * FROM chksetconfig();
db | role | rolkeyword | setconfig
-----+------------------+--------------+---------------------------
@@ -419,9 +416,6 @@ ALTER USER SESSION_USER RESET application_name;
ALTER USER "current_user" RESET application_name;
ALTER USER "Public" RESET application_name;
ALTER USER ALL RESET application_name;
ERROR: syntax error at or near "ALL"
LINE 1: ALTER USER ALL RESET application_name;
^
SELECT * FROM chksetconfig();
db | role | rolkeyword | setconfig
----+------+------------+-----------