Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitdf04db0

Browse files
committed
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>
1 parent3d76328 commitdf04db0

File tree

3 files changed

+17
-15
lines changed

3 files changed

+17
-15
lines changed

‎doc/src/sgml/ref/alter_user.sgml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,10 @@ ALTER USER <replaceable class="PARAMETER">role_specification</replaceable> [ WIT
3838

3939
ALTER USER <replaceable class="PARAMETER">name</replaceable> RENAME TO <replaceable>new_name</replaceable>
4040

41-
ALTER USER <replaceable class="PARAMETER">role_specification</replaceable> SET <replaceable>configuration_parameter</replaceable> { TO | = } { <replaceable>value</replaceable> | DEFAULT }
42-
ALTER USER <replaceable class="PARAMETER">role_specification</replaceable> SET <replaceable>configuration_parameter</replaceable> FROM CURRENT
43-
ALTER USER <replaceable class="PARAMETER">role_specification</replaceable> RESET <replaceable>configuration_parameter</replaceable>
44-
ALTER USER <replaceable class="PARAMETER">role_specification</replaceable> RESET ALL
41+
ALTER USER{<replaceable class="PARAMETER">role_specification</replaceable> | ALL } [ IN DATABASE <replaceable class="PARAMETER">database_name</replaceable> ] SET <replaceable>configuration_parameter</replaceable> { TO | = } { <replaceable>value</replaceable> | DEFAULT }
42+
ALTER USER{<replaceable class="PARAMETER">role_specification</replaceable> | ALL } [ IN DATABASE <replaceable class="PARAMETER">database_name</replaceable> ] SET <replaceable>configuration_parameter</replaceable> FROM CURRENT
43+
ALTER USER{<replaceable class="PARAMETER">role_specification</replaceable> | ALL } [ IN DATABASE <replaceable class="PARAMETER">database_name</replaceable> ] RESET <replaceable>configuration_parameter</replaceable>
44+
ALTER USER{<replaceable class="PARAMETER">role_specification</replaceable> | ALL } [ IN DATABASE <replaceable class="PARAMETER">database_name</replaceable> ] RESET ALL
4545

4646
<phrase>where <replaceable class="PARAMETER">role_specification</replaceable> can be:</phrase>
4747

‎src/backend/parser/gram.y

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1111,12 +1111,20 @@ AlterUserStmt:
11111111

11121112

11131113
AlterUserSetStmt:
1114-
ALTERUSERRoleSpecSetResetClause
1114+
ALTERUSERRoleSpecopt_in_databaseSetResetClause
11151115
{
11161116
AlterRoleSetStmt *n = makeNode(AlterRoleSetStmt);
11171117
n->role =$3;
1118-
n->database =NULL;
1119-
n->setstmt =$4;
1118+
n->database =$4;
1119+
n->setstmt =$5;
1120+
$$ = (Node *)n;
1121+
}
1122+
|ALTERUSERALLopt_in_databaseSetResetClause
1123+
{
1124+
AlterRoleSetStmt *n = makeNode(AlterRoleSetStmt);
1125+
n->role =NULL;
1126+
n->database =$4;
1127+
n->setstmt =$5;
11201128
$$ = (Node *)n;
11211129
}
11221130
;

‎src/test/regress/expected/rolenames.out

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -310,9 +310,9 @@ ERROR: syntax error at or near "CURRENT_ROLE"
310310
LINE 1: ALTER USER CURRENT_ROLE WITH LOGIN;
311311
^
312312
ALTER USER ALL WITH REPLICATION; -- error
313-
ERROR: syntax error at or near "ALL"
313+
ERROR: syntax error at or near "WITH"
314314
LINE 1: ALTER USER ALL WITH REPLICATION;
315-
^
315+
^
316316
ALTER USER SESSION_ROLE WITH NOREPLICATION; -- error
317317
ERROR: role "session_role" does not exist
318318
ALTER USER PUBLIC WITH NOREPLICATION; -- error
@@ -392,9 +392,6 @@ ALTER USER SESSION_USER SET application_name to 'BAR';
392392
ALTER USER "current_user" SET application_name to 'FOOFOO';
393393
ALTER USER "Public" SET application_name to 'BARBAR';
394394
ALTER USER ALL SET application_name to 'SLAP';
395-
ERROR: syntax error at or near "ALL"
396-
LINE 1: ALTER USER ALL SET application_name to 'SLAP';
397-
^
398395
SELECT * FROM chksetconfig();
399396
db | role | rolkeyword | setconfig
400397
-----+------------------+--------------+---------------------------
@@ -419,9 +416,6 @@ ALTER USER SESSION_USER RESET application_name;
419416
ALTER USER "current_user" RESET application_name;
420417
ALTER USER "Public" RESET application_name;
421418
ALTER USER ALL RESET application_name;
422-
ERROR: syntax error at or near "ALL"
423-
LINE 1: ALTER USER ALL RESET application_name;
424-
^
425419
SELECT * FROM chksetconfig();
426420
db | role | rolkeyword | setconfig
427421
----+------+------------+-----------

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp