Fix up some loose ends for CURRENT_USER as RoleSpec
In commit 31eae6028e
, some documents were not updated to show the new
capability; fix that. Also, the error message you get when CURRENT_USER
and SESSION_USER are used in a context that doesn't accept them could be
clearer about it being a problem only in those contexts; so add the
word "here".
Author: Kyotaro HORIGUCHI
His patch submission also included changes to GRANT/REVOKE, but those
seemed more controversial, so I left them out. We can reconsider these
changes later.
This commit is contained in:
parent
924bcf4f16
commit
9d396af463
|
@ -23,7 +23,7 @@ PostgreSQL documentation
|
|||
<synopsis>
|
||||
ALTER POLICY <replaceable class="parameter">name</replaceable> ON <replaceable class="parameter">table_name</replaceable>
|
||||
[ RENAME TO <replaceable class="PARAMETER">new_name</replaceable> ]
|
||||
[ TO { <replaceable class="parameter">role_name</replaceable> | PUBLIC } [, ...] ]
|
||||
[ TO { <replaceable class="parameter">role_name</replaceable> | PUBLIC | CURRENT_USER | SESSION_USER } [, ...] ]
|
||||
[ USING ( <replaceable class="parameter">using_expression</replaceable> ) ]
|
||||
[ WITH CHECK ( <replaceable class="parameter">check_expression</replaceable> ) ]
|
||||
</synopsis>
|
||||
|
|
|
@ -23,7 +23,7 @@ PostgreSQL documentation
|
|||
<synopsis>
|
||||
CREATE POLICY <replaceable class="parameter">name</replaceable> ON <replaceable class="parameter">table_name</replaceable>
|
||||
[ FOR { ALL | SELECT | INSERT | UPDATE | DELETE } ]
|
||||
[ TO { <replaceable class="parameter">role_name</replaceable> | PUBLIC } [, ...] ]
|
||||
[ TO { <replaceable class="parameter">role_name</replaceable> | PUBLIC | CURRENT_USER | SESSION_USER } [, ...] ]
|
||||
[ USING ( <replaceable class="parameter">using_expression</replaceable> ) ]
|
||||
[ WITH CHECK ( <replaceable class="parameter">check_expression</replaceable> ) ]
|
||||
</synopsis>
|
||||
|
|
|
@ -22,7 +22,7 @@ PostgreSQL documentation
|
|||
<refsynopsisdiv>
|
||||
<synopsis>
|
||||
CREATE TABLESPACE <replaceable class="parameter">tablespace_name</replaceable>
|
||||
[ OWNER <replaceable class="parameter">user_name</replaceable> ]
|
||||
[ OWNER { <replaceable>new_owner</replaceable> | CURRENT_USER | SESSION_USER } ]
|
||||
LOCATION '<replaceable class="parameter">directory</replaceable>'
|
||||
[ WITH ( <replaceable class="PARAMETER">tablespace_option</replaceable> = <replaceable class="PARAMETER">value</replaceable> [, ... ] ) ]
|
||||
</synopsis>
|
||||
|
|
|
@ -21,7 +21,7 @@ PostgreSQL documentation
|
|||
|
||||
<refsynopsisdiv>
|
||||
<synopsis>
|
||||
DROP OWNED BY <replaceable class="PARAMETER">name</replaceable> [, ...] [ CASCADE | RESTRICT ]
|
||||
DROP OWNED BY { <replaceable class="PARAMETER">name</replaceable> | CURRENT_USER | SESSION_USER } [, ...] [ CASCADE | RESTRICT ]
|
||||
</synopsis>
|
||||
</refsynopsisdiv>
|
||||
|
||||
|
|
|
@ -21,7 +21,8 @@ PostgreSQL documentation
|
|||
|
||||
<refsynopsisdiv>
|
||||
<synopsis>
|
||||
REASSIGN OWNED BY <replaceable class="PARAMETER">old_role</replaceable> [, ...] TO <replaceable class="PARAMETER">new_role</replaceable>
|
||||
REASSIGN OWNED BY { <replaceable class="PARAMETER">old_role</replaceable> | CURRENT_USER | SESSION_USER } [, ...]
|
||||
TO { <replaceable class="PARAMETER">new_role</replaceable> | CURRENT_USER | SESSION_USER }
|
||||
</synopsis>
|
||||
</refsynopsisdiv>
|
||||
|
||||
|
|
|
@ -13216,13 +13216,13 @@ RoleId: RoleSpec
|
|||
case ROLESPEC_SESSION_USER:
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_RESERVED_NAME),
|
||||
errmsg("%s cannot be used as a role name",
|
||||
errmsg("%s cannot be used as a role name here",
|
||||
"SESSION_USER"),
|
||||
parser_errposition(@1)));
|
||||
case ROLESPEC_CURRENT_USER:
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_RESERVED_NAME),
|
||||
errmsg("%s cannot be used as a role name",
|
||||
errmsg("%s cannot be used as a role name here",
|
||||
"CURRENT_USER"),
|
||||
parser_errposition(@1)));
|
||||
}
|
||||
|
|
|
@ -43,7 +43,7 @@ CREATE ROLE "current_user";
|
|||
CREATE ROLE "session_user";
|
||||
CREATE ROLE "user";
|
||||
CREATE ROLE current_user; -- error
|
||||
ERROR: CURRENT_USER cannot be used as a role name
|
||||
ERROR: CURRENT_USER cannot be used as a role name here
|
||||
LINE 1: CREATE ROLE current_user;
|
||||
^
|
||||
CREATE ROLE current_role; -- error
|
||||
|
@ -51,7 +51,7 @@ ERROR: syntax error at or near "current_role"
|
|||
LINE 1: CREATE ROLE current_role;
|
||||
^
|
||||
CREATE ROLE session_user; -- error
|
||||
ERROR: SESSION_USER cannot be used as a role name
|
||||
ERROR: SESSION_USER cannot be used as a role name here
|
||||
LINE 1: CREATE ROLE session_user;
|
||||
^
|
||||
CREATE ROLE user; -- error
|
||||
|
|
Loading…
Reference in New Issue