Commit 45b98057 authored by Peter Eisentraut's avatar Peter Eisentraut

Allow CURRENT_ROLE where CURRENT_USER is accepted

In the particular case of GRANTED BY, this is specified in the SQL
standard.  Since in PostgreSQL, CURRENT_ROLE is equivalent to
CURRENT_USER, and CURRENT_USER is already supported here, adding
CURRENT_ROLE is trivial.  The other cases are PostgreSQL extensions,
but for the same reason it also makes sense there.
Reviewed-by: default avatarVik Fearing <vik@postgresfriends.org>
Reviewed-by: default avatarAsif Rehman <asifr.rehman@gmail.com>
Reviewed-by: default avatarAlvaro Herrera <alvherre@2ndquadrant.com>
Discussion: https://www.postgresql.org/message-id/flat/f2feac44-b4c5-f38f-3699-2851d6a76dc9%402ndquadrant.com
parent 16fa9b2b
...@@ -23,7 +23,7 @@ PostgreSQL documentation ...@@ -23,7 +23,7 @@ PostgreSQL documentation
<synopsis> <synopsis>
ALTER AGGREGATE <replaceable>name</replaceable> ( <replaceable>aggregate_signature</replaceable> ) RENAME TO <replaceable>new_name</replaceable> ALTER AGGREGATE <replaceable>name</replaceable> ( <replaceable>aggregate_signature</replaceable> ) RENAME TO <replaceable>new_name</replaceable>
ALTER AGGREGATE <replaceable>name</replaceable> ( <replaceable>aggregate_signature</replaceable> ) ALTER AGGREGATE <replaceable>name</replaceable> ( <replaceable>aggregate_signature</replaceable> )
OWNER TO { <replaceable>new_owner</replaceable> | CURRENT_USER | SESSION_USER } OWNER TO { <replaceable>new_owner</replaceable> | CURRENT_ROLE | CURRENT_USER | SESSION_USER }
ALTER AGGREGATE <replaceable>name</replaceable> ( <replaceable>aggregate_signature</replaceable> ) SET SCHEMA <replaceable>new_schema</replaceable> ALTER AGGREGATE <replaceable>name</replaceable> ( <replaceable>aggregate_signature</replaceable> ) SET SCHEMA <replaceable>new_schema</replaceable>
<phrase>where <replaceable>aggregate_signature</replaceable> is:</phrase> <phrase>where <replaceable>aggregate_signature</replaceable> is:</phrase>
......
...@@ -24,7 +24,7 @@ PostgreSQL documentation ...@@ -24,7 +24,7 @@ PostgreSQL documentation
ALTER COLLATION <replaceable>name</replaceable> REFRESH VERSION ALTER COLLATION <replaceable>name</replaceable> REFRESH VERSION
ALTER COLLATION <replaceable>name</replaceable> RENAME TO <replaceable>new_name</replaceable> ALTER COLLATION <replaceable>name</replaceable> RENAME TO <replaceable>new_name</replaceable>
ALTER COLLATION <replaceable>name</replaceable> OWNER TO { <replaceable>new_owner</replaceable> | CURRENT_USER | SESSION_USER } ALTER COLLATION <replaceable>name</replaceable> OWNER TO { <replaceable>new_owner</replaceable> | CURRENT_ROLE | CURRENT_USER | SESSION_USER }
ALTER COLLATION <replaceable>name</replaceable> SET SCHEMA <replaceable>new_schema</replaceable> ALTER COLLATION <replaceable>name</replaceable> SET SCHEMA <replaceable>new_schema</replaceable>
</synopsis> </synopsis>
</refsynopsisdiv> </refsynopsisdiv>
......
...@@ -22,7 +22,7 @@ PostgreSQL documentation ...@@ -22,7 +22,7 @@ PostgreSQL documentation
<refsynopsisdiv> <refsynopsisdiv>
<synopsis> <synopsis>
ALTER CONVERSION <replaceable>name</replaceable> RENAME TO <replaceable>new_name</replaceable> ALTER CONVERSION <replaceable>name</replaceable> RENAME TO <replaceable>new_name</replaceable>
ALTER CONVERSION <replaceable>name</replaceable> OWNER TO { <replaceable>new_owner</replaceable> | CURRENT_USER | SESSION_USER } ALTER CONVERSION <replaceable>name</replaceable> OWNER TO { <replaceable>new_owner</replaceable> | CURRENT_ROLE | CURRENT_USER | SESSION_USER }
ALTER CONVERSION <replaceable>name</replaceable> SET SCHEMA <replaceable>new_schema</replaceable> ALTER CONVERSION <replaceable>name</replaceable> SET SCHEMA <replaceable>new_schema</replaceable>
</synopsis> </synopsis>
</refsynopsisdiv> </refsynopsisdiv>
......
...@@ -31,7 +31,7 @@ ALTER DATABASE <replaceable class="parameter">name</replaceable> [ [ WITH ] <rep ...@@ -31,7 +31,7 @@ ALTER DATABASE <replaceable class="parameter">name</replaceable> [ [ WITH ] <rep
ALTER DATABASE <replaceable class="parameter">name</replaceable> RENAME TO <replaceable>new_name</replaceable> ALTER DATABASE <replaceable class="parameter">name</replaceable> RENAME TO <replaceable>new_name</replaceable>
ALTER DATABASE <replaceable class="parameter">name</replaceable> OWNER TO { <replaceable>new_owner</replaceable> | CURRENT_USER | SESSION_USER } ALTER DATABASE <replaceable class="parameter">name</replaceable> OWNER TO { <replaceable>new_owner</replaceable> | CURRENT_ROLE | CURRENT_USER | SESSION_USER }
ALTER DATABASE <replaceable class="parameter">name</replaceable> SET TABLESPACE <replaceable class="parameter">new_tablespace</replaceable> ALTER DATABASE <replaceable class="parameter">name</replaceable> SET TABLESPACE <replaceable class="parameter">new_tablespace</replaceable>
......
...@@ -36,7 +36,7 @@ ALTER DOMAIN <replaceable class="parameter">name</replaceable> ...@@ -36,7 +36,7 @@ ALTER DOMAIN <replaceable class="parameter">name</replaceable>
ALTER DOMAIN <replaceable class="parameter">name</replaceable> ALTER DOMAIN <replaceable class="parameter">name</replaceable>
VALIDATE CONSTRAINT <replaceable class="parameter">constraint_name</replaceable> VALIDATE CONSTRAINT <replaceable class="parameter">constraint_name</replaceable>
ALTER DOMAIN <replaceable class="parameter">name</replaceable> ALTER DOMAIN <replaceable class="parameter">name</replaceable>
OWNER TO { <replaceable class="parameter">new_owner</replaceable> | CURRENT_USER | SESSION_USER } OWNER TO { <replaceable class="parameter">new_owner</replaceable> | CURRENT_ROLE | CURRENT_USER | SESSION_USER }
ALTER DOMAIN <replaceable class="parameter">name</replaceable> ALTER DOMAIN <replaceable class="parameter">name</replaceable>
RENAME TO <replaceable class="parameter">new_name</replaceable> RENAME TO <replaceable class="parameter">new_name</replaceable>
ALTER DOMAIN <replaceable class="parameter">name</replaceable> ALTER DOMAIN <replaceable class="parameter">name</replaceable>
......
...@@ -23,7 +23,7 @@ PostgreSQL documentation ...@@ -23,7 +23,7 @@ PostgreSQL documentation
<synopsis> <synopsis>
ALTER EVENT TRIGGER <replaceable class="parameter">name</replaceable> DISABLE ALTER EVENT TRIGGER <replaceable class="parameter">name</replaceable> DISABLE
ALTER EVENT TRIGGER <replaceable class="parameter">name</replaceable> ENABLE [ REPLICA | ALWAYS ] ALTER EVENT TRIGGER <replaceable class="parameter">name</replaceable> ENABLE [ REPLICA | ALWAYS ]
ALTER EVENT TRIGGER <replaceable class="parameter">name</replaceable> OWNER TO { <replaceable class="parameter">new_owner</replaceable> | CURRENT_USER | SESSION_USER } ALTER EVENT TRIGGER <replaceable class="parameter">name</replaceable> OWNER TO { <replaceable class="parameter">new_owner</replaceable> | CURRENT_ROLE | CURRENT_USER | SESSION_USER }
ALTER EVENT TRIGGER <replaceable class="parameter">name</replaceable> RENAME TO <replaceable class="parameter">new_name</replaceable> ALTER EVENT TRIGGER <replaceable class="parameter">name</replaceable> RENAME TO <replaceable class="parameter">new_name</replaceable>
</synopsis> </synopsis>
</refsynopsisdiv> </refsynopsisdiv>
......
...@@ -25,7 +25,7 @@ ALTER FOREIGN DATA WRAPPER <replaceable class="parameter">name</replaceable> ...@@ -25,7 +25,7 @@ ALTER FOREIGN DATA WRAPPER <replaceable class="parameter">name</replaceable>
[ HANDLER <replaceable class="parameter">handler_function</replaceable> | NO HANDLER ] [ HANDLER <replaceable class="parameter">handler_function</replaceable> | NO HANDLER ]
[ VALIDATOR <replaceable class="parameter">validator_function</replaceable> | NO VALIDATOR ] [ VALIDATOR <replaceable class="parameter">validator_function</replaceable> | NO VALIDATOR ]
[ OPTIONS ( [ ADD | SET | DROP ] <replaceable class="parameter">option</replaceable> ['<replaceable class="parameter">value</replaceable>'] [, ... ]) ] [ OPTIONS ( [ ADD | SET | DROP ] <replaceable class="parameter">option</replaceable> ['<replaceable class="parameter">value</replaceable>'] [, ... ]) ]
ALTER FOREIGN DATA WRAPPER <replaceable class="parameter">name</replaceable> OWNER TO { <replaceable>new_owner</replaceable> | CURRENT_USER | SESSION_USER } ALTER FOREIGN DATA WRAPPER <replaceable class="parameter">name</replaceable> OWNER TO { <replaceable>new_owner</replaceable> | CURRENT_ROLE | CURRENT_USER | SESSION_USER }
ALTER FOREIGN DATA WRAPPER <replaceable class="parameter">name</replaceable> RENAME TO <replaceable>new_name</replaceable> ALTER FOREIGN DATA WRAPPER <replaceable class="parameter">name</replaceable> RENAME TO <replaceable>new_name</replaceable>
</synopsis> </synopsis>
</refsynopsisdiv> </refsynopsisdiv>
......
...@@ -53,7 +53,7 @@ ALTER FOREIGN TABLE [ IF EXISTS ] <replaceable class="parameter">name</replaceab ...@@ -53,7 +53,7 @@ ALTER FOREIGN TABLE [ IF EXISTS ] <replaceable class="parameter">name</replaceab
SET WITHOUT OIDS SET WITHOUT OIDS
INHERIT <replaceable class="parameter">parent_table</replaceable> INHERIT <replaceable class="parameter">parent_table</replaceable>
NO INHERIT <replaceable class="parameter">parent_table</replaceable> NO INHERIT <replaceable class="parameter">parent_table</replaceable>
OWNER TO { <replaceable class="parameter">new_owner</replaceable> | CURRENT_USER | SESSION_USER } OWNER TO { <replaceable class="parameter">new_owner</replaceable> | CURRENT_ROLE | CURRENT_USER | SESSION_USER }
OPTIONS ( [ ADD | SET | DROP ] <replaceable class="parameter">option</replaceable> ['<replaceable class="parameter">value</replaceable>'] [, ... ]) OPTIONS ( [ ADD | SET | DROP ] <replaceable class="parameter">option</replaceable> ['<replaceable class="parameter">value</replaceable>'] [, ... ])
</synopsis> </synopsis>
</refsynopsisdiv> </refsynopsisdiv>
......
...@@ -26,7 +26,7 @@ ALTER FUNCTION <replaceable>name</replaceable> [ ( [ [ <replaceable class="param ...@@ -26,7 +26,7 @@ ALTER FUNCTION <replaceable>name</replaceable> [ ( [ [ <replaceable class="param
ALTER FUNCTION <replaceable>name</replaceable> [ ( [ [ <replaceable class="parameter">argmode</replaceable> ] [ <replaceable class="parameter">argname</replaceable> ] <replaceable class="parameter">argtype</replaceable> [, ...] ] ) ] ALTER FUNCTION <replaceable>name</replaceable> [ ( [ [ <replaceable class="parameter">argmode</replaceable> ] [ <replaceable class="parameter">argname</replaceable> ] <replaceable class="parameter">argtype</replaceable> [, ...] ] ) ]
RENAME TO <replaceable>new_name</replaceable> RENAME TO <replaceable>new_name</replaceable>
ALTER FUNCTION <replaceable>name</replaceable> [ ( [ [ <replaceable class="parameter">argmode</replaceable> ] [ <replaceable class="parameter">argname</replaceable> ] <replaceable class="parameter">argtype</replaceable> [, ...] ] ) ] ALTER FUNCTION <replaceable>name</replaceable> [ ( [ [ <replaceable class="parameter">argmode</replaceable> ] [ <replaceable class="parameter">argname</replaceable> ] <replaceable class="parameter">argtype</replaceable> [, ...] ] ) ]
OWNER TO { <replaceable>new_owner</replaceable> | CURRENT_USER | SESSION_USER } OWNER TO { <replaceable>new_owner</replaceable> | CURRENT_ROLE | CURRENT_USER | SESSION_USER }
ALTER FUNCTION <replaceable>name</replaceable> [ ( [ [ <replaceable class="parameter">argmode</replaceable> ] [ <replaceable class="parameter">argname</replaceable> ] <replaceable class="parameter">argtype</replaceable> [, ...] ] ) ] ALTER FUNCTION <replaceable>name</replaceable> [ ( [ [ <replaceable class="parameter">argmode</replaceable> ] [ <replaceable class="parameter">argname</replaceable> ] <replaceable class="parameter">argtype</replaceable> [, ...] ] ) ]
SET SCHEMA <replaceable>new_schema</replaceable> SET SCHEMA <replaceable>new_schema</replaceable>
ALTER FUNCTION <replaceable>name</replaceable> [ ( [ [ <replaceable class="parameter">argmode</replaceable> ] [ <replaceable class="parameter">argname</replaceable> ] <replaceable class="parameter">argtype</replaceable> [, ...] ] ) ] ALTER FUNCTION <replaceable>name</replaceable> [ ( [ [ <replaceable class="parameter">argmode</replaceable> ] [ <replaceable class="parameter">argname</replaceable> ] <replaceable class="parameter">argtype</replaceable> [, ...] ] ) ]
......
...@@ -27,6 +27,7 @@ ALTER GROUP <replaceable class="parameter">role_specification</replaceable> DROP ...@@ -27,6 +27,7 @@ ALTER GROUP <replaceable class="parameter">role_specification</replaceable> DROP
<phrase>where <replaceable class="parameter">role_specification</replaceable> can be:</phrase> <phrase>where <replaceable class="parameter">role_specification</replaceable> can be:</phrase>
<replaceable class="parameter">role_name</replaceable> <replaceable class="parameter">role_name</replaceable>
| CURRENT_ROLE
| CURRENT_USER | CURRENT_USER
| SESSION_USER | SESSION_USER
......
...@@ -22,7 +22,7 @@ PostgreSQL documentation ...@@ -22,7 +22,7 @@ PostgreSQL documentation
<refsynopsisdiv> <refsynopsisdiv>
<synopsis> <synopsis>
ALTER [ PROCEDURAL ] LANGUAGE <replaceable>name</replaceable> RENAME TO <replaceable>new_name</replaceable> ALTER [ PROCEDURAL ] LANGUAGE <replaceable>name</replaceable> RENAME TO <replaceable>new_name</replaceable>
ALTER [ PROCEDURAL ] LANGUAGE <replaceable>name</replaceable> OWNER TO { <replaceable>new_owner</replaceable> | CURRENT_USER | SESSION_USER } ALTER [ PROCEDURAL ] LANGUAGE <replaceable>name</replaceable> OWNER TO { <replaceable>new_owner</replaceable> | CURRENT_ROLE | CURRENT_USER | SESSION_USER }
</synopsis> </synopsis>
</refsynopsisdiv> </refsynopsisdiv>
......
...@@ -21,7 +21,7 @@ PostgreSQL documentation ...@@ -21,7 +21,7 @@ PostgreSQL documentation
<refsynopsisdiv> <refsynopsisdiv>
<synopsis> <synopsis>
ALTER LARGE OBJECT <replaceable class="parameter">large_object_oid</replaceable> OWNER TO { <replaceable>new_owner</replaceable> | CURRENT_USER | SESSION_USER } ALTER LARGE OBJECT <replaceable class="parameter">large_object_oid</replaceable> OWNER TO { <replaceable>new_owner</replaceable> | CURRENT_ROLE | CURRENT_USER | SESSION_USER }
</synopsis> </synopsis>
</refsynopsisdiv> </refsynopsisdiv>
......
...@@ -44,7 +44,7 @@ ALTER MATERIALIZED VIEW ALL IN TABLESPACE <replaceable class="parameter">name</r ...@@ -44,7 +44,7 @@ ALTER MATERIALIZED VIEW ALL IN TABLESPACE <replaceable class="parameter">name</r
SET WITHOUT CLUSTER SET WITHOUT CLUSTER
SET ( <replaceable class="parameter">storage_parameter</replaceable> [= <replaceable class="parameter">value</replaceable>] [, ... ] ) SET ( <replaceable class="parameter">storage_parameter</replaceable> [= <replaceable class="parameter">value</replaceable>] [, ... ] )
RESET ( <replaceable class="parameter">storage_parameter</replaceable> [, ... ] ) RESET ( <replaceable class="parameter">storage_parameter</replaceable> [, ... ] )
OWNER TO { <replaceable class="parameter">new_owner</replaceable> | CURRENT_USER | SESSION_USER } OWNER TO { <replaceable class="parameter">new_owner</replaceable> | CURRENT_ROLE | CURRENT_USER | SESSION_USER }
</synopsis> </synopsis>
</refsynopsisdiv> </refsynopsisdiv>
......
...@@ -25,7 +25,7 @@ ALTER OPERATOR CLASS <replaceable>name</replaceable> USING <replaceable class="p ...@@ -25,7 +25,7 @@ ALTER OPERATOR CLASS <replaceable>name</replaceable> USING <replaceable class="p
RENAME TO <replaceable>new_name</replaceable> RENAME TO <replaceable>new_name</replaceable>
ALTER OPERATOR CLASS <replaceable>name</replaceable> USING <replaceable class="parameter">index_method</replaceable> ALTER OPERATOR CLASS <replaceable>name</replaceable> USING <replaceable class="parameter">index_method</replaceable>
OWNER TO { <replaceable>new_owner</replaceable> | CURRENT_USER | SESSION_USER } OWNER TO { <replaceable>new_owner</replaceable> | CURRENT_ROLE | CURRENT_USER | SESSION_USER }
ALTER OPERATOR CLASS <replaceable>name</replaceable> USING <replaceable class="parameter">index_method</replaceable> ALTER OPERATOR CLASS <replaceable>name</replaceable> USING <replaceable class="parameter">index_method</replaceable>
SET SCHEMA <replaceable>new_schema</replaceable> SET SCHEMA <replaceable>new_schema</replaceable>
......
...@@ -22,7 +22,7 @@ PostgreSQL documentation ...@@ -22,7 +22,7 @@ PostgreSQL documentation
<refsynopsisdiv> <refsynopsisdiv>
<synopsis> <synopsis>
ALTER OPERATOR <replaceable>name</replaceable> ( { <replaceable>left_type</replaceable> | NONE } , { <replaceable>right_type</replaceable> | NONE } ) ALTER OPERATOR <replaceable>name</replaceable> ( { <replaceable>left_type</replaceable> | NONE } , { <replaceable>right_type</replaceable> | NONE } )
OWNER TO { <replaceable>new_owner</replaceable> | CURRENT_USER | SESSION_USER } OWNER TO { <replaceable>new_owner</replaceable> | CURRENT_ROLE | CURRENT_USER | SESSION_USER }
ALTER OPERATOR <replaceable>name</replaceable> ( { <replaceable>left_type</replaceable> | NONE } , { <replaceable>right_type</replaceable> | NONE } ) ALTER OPERATOR <replaceable>name</replaceable> ( { <replaceable>left_type</replaceable> | NONE } , { <replaceable>right_type</replaceable> | NONE } )
SET SCHEMA <replaceable>new_schema</replaceable> SET SCHEMA <replaceable>new_schema</replaceable>
......
...@@ -37,7 +37,7 @@ ALTER OPERATOR FAMILY <replaceable>name</replaceable> USING <replaceable class=" ...@@ -37,7 +37,7 @@ ALTER OPERATOR FAMILY <replaceable>name</replaceable> USING <replaceable class="
RENAME TO <replaceable>new_name</replaceable> RENAME TO <replaceable>new_name</replaceable>
ALTER OPERATOR FAMILY <replaceable>name</replaceable> USING <replaceable class="parameter">index_method</replaceable> ALTER OPERATOR FAMILY <replaceable>name</replaceable> USING <replaceable class="parameter">index_method</replaceable>
OWNER TO { <replaceable>new_owner</replaceable> | CURRENT_USER | SESSION_USER } OWNER TO { <replaceable>new_owner</replaceable> | CURRENT_ROLE | CURRENT_USER | SESSION_USER }
ALTER OPERATOR FAMILY <replaceable>name</replaceable> USING <replaceable class="parameter">index_method</replaceable> ALTER OPERATOR FAMILY <replaceable>name</replaceable> USING <replaceable class="parameter">index_method</replaceable>
SET SCHEMA <replaceable>new_schema</replaceable> SET SCHEMA <replaceable>new_schema</replaceable>
......
...@@ -24,7 +24,7 @@ PostgreSQL documentation ...@@ -24,7 +24,7 @@ PostgreSQL documentation
ALTER POLICY <replaceable class="parameter">name</replaceable> ON <replaceable class="parameter">table_name</replaceable> RENAME TO <replaceable class="parameter">new_name</replaceable> ALTER POLICY <replaceable class="parameter">name</replaceable> ON <replaceable class="parameter">table_name</replaceable> RENAME TO <replaceable class="parameter">new_name</replaceable>
ALTER POLICY <replaceable class="parameter">name</replaceable> ON <replaceable class="parameter">table_name</replaceable> ALTER POLICY <replaceable class="parameter">name</replaceable> ON <replaceable class="parameter">table_name</replaceable>
[ TO { <replaceable class="parameter">role_name</replaceable> | PUBLIC | CURRENT_USER | SESSION_USER } [, ...] ] [ TO { <replaceable class="parameter">role_name</replaceable> | PUBLIC | CURRENT_ROLE | CURRENT_USER | SESSION_USER } [, ...] ]
[ USING ( <replaceable class="parameter">using_expression</replaceable> ) ] [ USING ( <replaceable class="parameter">using_expression</replaceable> ) ]
[ WITH CHECK ( <replaceable class="parameter">check_expression</replaceable> ) ] [ WITH CHECK ( <replaceable class="parameter">check_expression</replaceable> ) ]
</synopsis> </synopsis>
......
...@@ -26,7 +26,7 @@ ALTER PROCEDURE <replaceable>name</replaceable> [ ( [ [ <replaceable class="para ...@@ -26,7 +26,7 @@ ALTER PROCEDURE <replaceable>name</replaceable> [ ( [ [ <replaceable class="para
ALTER PROCEDURE <replaceable>name</replaceable> [ ( [ [ <replaceable class="parameter">argmode</replaceable> ] [ <replaceable class="parameter">argname</replaceable> ] <replaceable class="parameter">argtype</replaceable> [, ...] ] ) ] ALTER PROCEDURE <replaceable>name</replaceable> [ ( [ [ <replaceable class="parameter">argmode</replaceable> ] [ <replaceable class="parameter">argname</replaceable> ] <replaceable class="parameter">argtype</replaceable> [, ...] ] ) ]
RENAME TO <replaceable>new_name</replaceable> RENAME TO <replaceable>new_name</replaceable>
ALTER PROCEDURE <replaceable>name</replaceable> [ ( [ [ <replaceable class="parameter">argmode</replaceable> ] [ <replaceable class="parameter">argname</replaceable> ] <replaceable class="parameter">argtype</replaceable> [, ...] ] ) ] ALTER PROCEDURE <replaceable>name</replaceable> [ ( [ [ <replaceable class="parameter">argmode</replaceable> ] [ <replaceable class="parameter">argname</replaceable> ] <replaceable class="parameter">argtype</replaceable> [, ...] ] ) ]
OWNER TO { <replaceable>new_owner</replaceable> | CURRENT_USER | SESSION_USER } OWNER TO { <replaceable>new_owner</replaceable> | CURRENT_ROLE | CURRENT_USER | SESSION_USER }
ALTER PROCEDURE <replaceable>name</replaceable> [ ( [ [ <replaceable class="parameter">argmode</replaceable> ] [ <replaceable class="parameter">argname</replaceable> ] <replaceable class="parameter">argtype</replaceable> [, ...] ] ) ] ALTER PROCEDURE <replaceable>name</replaceable> [ ( [ [ <replaceable class="parameter">argmode</replaceable> ] [ <replaceable class="parameter">argname</replaceable> ] <replaceable class="parameter">argtype</replaceable> [, ...] ] ) ]
SET SCHEMA <replaceable>new_schema</replaceable> SET SCHEMA <replaceable>new_schema</replaceable>
ALTER PROCEDURE <replaceable>name</replaceable> [ ( [ [ <replaceable class="parameter">argmode</replaceable> ] [ <replaceable class="parameter">argname</replaceable> ] <replaceable class="parameter">argtype</replaceable> [, ...] ] ) ] ALTER PROCEDURE <replaceable>name</replaceable> [ ( [ [ <replaceable class="parameter">argmode</replaceable> ] [ <replaceable class="parameter">argname</replaceable> ] <replaceable class="parameter">argtype</replaceable> [, ...] ] ) ]
......
...@@ -25,7 +25,7 @@ ALTER PUBLICATION <replaceable class="parameter">name</replaceable> ADD TABLE [ ...@@ -25,7 +25,7 @@ ALTER PUBLICATION <replaceable class="parameter">name</replaceable> ADD TABLE [
ALTER PUBLICATION <replaceable class="parameter">name</replaceable> SET TABLE [ ONLY ] <replaceable class="parameter">table_name</replaceable> [ * ] [, ...] ALTER PUBLICATION <replaceable class="parameter">name</replaceable> SET TABLE [ ONLY ] <replaceable class="parameter">table_name</replaceable> [ * ] [, ...]
ALTER PUBLICATION <replaceable class="parameter">name</replaceable> DROP TABLE [ ONLY ] <replaceable class="parameter">table_name</replaceable> [ * ] [, ...] ALTER PUBLICATION <replaceable class="parameter">name</replaceable> DROP TABLE [ ONLY ] <replaceable class="parameter">table_name</replaceable> [ * ] [, ...]
ALTER PUBLICATION <replaceable class="parameter">name</replaceable> SET ( <replaceable class="parameter">publication_parameter</replaceable> [= <replaceable class="parameter">value</replaceable>] [, ... ] ) ALTER PUBLICATION <replaceable class="parameter">name</replaceable> SET ( <replaceable class="parameter">publication_parameter</replaceable> [= <replaceable class="parameter">value</replaceable>] [, ... ] )
ALTER PUBLICATION <replaceable class="parameter">name</replaceable> OWNER TO { <replaceable>new_owner</replaceable> | CURRENT_USER | SESSION_USER } ALTER PUBLICATION <replaceable class="parameter">name</replaceable> OWNER TO { <replaceable>new_owner</replaceable> | CURRENT_ROLE | CURRENT_USER | SESSION_USER }
ALTER PUBLICATION <replaceable class="parameter">name</replaceable> RENAME TO <replaceable>new_name</replaceable> ALTER PUBLICATION <replaceable class="parameter">name</replaceable> RENAME TO <replaceable>new_name</replaceable>
</synopsis> </synopsis>
</refsynopsisdiv> </refsynopsisdiv>
......
...@@ -46,6 +46,7 @@ ALTER ROLE { <replaceable class="parameter">role_specification</replaceable> | A ...@@ -46,6 +46,7 @@ ALTER ROLE { <replaceable class="parameter">role_specification</replaceable> | A
<phrase>where <replaceable class="parameter">role_specification</replaceable> can be:</phrase> <phrase>where <replaceable class="parameter">role_specification</replaceable> can be:</phrase>
<replaceable class="parameter">role_name</replaceable> <replaceable class="parameter">role_name</replaceable>
| CURRENT_ROLE
| CURRENT_USER | CURRENT_USER
| SESSION_USER | SESSION_USER
</synopsis> </synopsis>
...@@ -134,6 +135,7 @@ ALTER ROLE { <replaceable class="parameter">role_specification</replaceable> | A ...@@ -134,6 +135,7 @@ ALTER ROLE { <replaceable class="parameter">role_specification</replaceable> | A
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term><literal>CURRENT_ROLE</literal></term>
<term><literal>CURRENT_USER</literal></term> <term><literal>CURRENT_USER</literal></term>
<listitem> <listitem>
<para> <para>
......
...@@ -26,7 +26,7 @@ ALTER ROUTINE <replaceable>name</replaceable> [ ( [ [ <replaceable class="parame ...@@ -26,7 +26,7 @@ ALTER ROUTINE <replaceable>name</replaceable> [ ( [ [ <replaceable class="parame
ALTER ROUTINE <replaceable>name</replaceable> [ ( [ [ <replaceable class="parameter">argmode</replaceable> ] [ <replaceable class="parameter">argname</replaceable> ] <replaceable class="parameter">argtype</replaceable> [, ...] ] ) ] ALTER ROUTINE <replaceable>name</replaceable> [ ( [ [ <replaceable class="parameter">argmode</replaceable> ] [ <replaceable class="parameter">argname</replaceable> ] <replaceable class="parameter">argtype</replaceable> [, ...] ] ) ]
RENAME TO <replaceable>new_name</replaceable> RENAME TO <replaceable>new_name</replaceable>
ALTER ROUTINE <replaceable>name</replaceable> [ ( [ [ <replaceable class="parameter">argmode</replaceable> ] [ <replaceable class="parameter">argname</replaceable> ] <replaceable class="parameter">argtype</replaceable> [, ...] ] ) ] ALTER ROUTINE <replaceable>name</replaceable> [ ( [ [ <replaceable class="parameter">argmode</replaceable> ] [ <replaceable class="parameter">argname</replaceable> ] <replaceable class="parameter">argtype</replaceable> [, ...] ] ) ]
OWNER TO { <replaceable>new_owner</replaceable> | CURRENT_USER | SESSION_USER } OWNER TO { <replaceable>new_owner</replaceable> | CURRENT_ROLE | CURRENT_USER | SESSION_USER }
ALTER ROUTINE <replaceable>name</replaceable> [ ( [ [ <replaceable class="parameter">argmode</replaceable> ] [ <replaceable class="parameter">argname</replaceable> ] <replaceable class="parameter">argtype</replaceable> [, ...] ] ) ] ALTER ROUTINE <replaceable>name</replaceable> [ ( [ [ <replaceable class="parameter">argmode</replaceable> ] [ <replaceable class="parameter">argname</replaceable> ] <replaceable class="parameter">argtype</replaceable> [, ...] ] ) ]
SET SCHEMA <replaceable>new_schema</replaceable> SET SCHEMA <replaceable>new_schema</replaceable>
ALTER ROUTINE <replaceable>name</replaceable> [ ( [ [ <replaceable class="parameter">argmode</replaceable> ] [ <replaceable class="parameter">argname</replaceable> ] <replaceable class="parameter">argtype</replaceable> [, ...] ] ) ] ALTER ROUTINE <replaceable>name</replaceable> [ ( [ [ <replaceable class="parameter">argmode</replaceable> ] [ <replaceable class="parameter">argname</replaceable> ] <replaceable class="parameter">argtype</replaceable> [, ...] ] ) ]
......
...@@ -22,7 +22,7 @@ PostgreSQL documentation ...@@ -22,7 +22,7 @@ PostgreSQL documentation
<refsynopsisdiv> <refsynopsisdiv>
<synopsis> <synopsis>
ALTER SCHEMA <replaceable>name</replaceable> RENAME TO <replaceable>new_name</replaceable> ALTER SCHEMA <replaceable>name</replaceable> RENAME TO <replaceable>new_name</replaceable>
ALTER SCHEMA <replaceable>name</replaceable> OWNER TO { <replaceable>new_owner</replaceable> | CURRENT_USER | SESSION_USER } ALTER SCHEMA <replaceable>name</replaceable> OWNER TO { <replaceable>new_owner</replaceable> | CURRENT_ROLE | CURRENT_USER | SESSION_USER }
</synopsis> </synopsis>
</refsynopsisdiv> </refsynopsisdiv>
......
...@@ -31,7 +31,7 @@ ALTER SEQUENCE [ IF EXISTS ] <replaceable class="parameter">name</replaceable> ...@@ -31,7 +31,7 @@ ALTER SEQUENCE [ IF EXISTS ] <replaceable class="parameter">name</replaceable>
[ RESTART [ [ WITH ] <replaceable class="parameter">restart</replaceable> ] ] [ RESTART [ [ WITH ] <replaceable class="parameter">restart</replaceable> ] ]
[ CACHE <replaceable class="parameter">cache</replaceable> ] [ [ NO ] CYCLE ] [ CACHE <replaceable class="parameter">cache</replaceable> ] [ [ NO ] CYCLE ]
[ OWNED BY { <replaceable class="parameter">table_name</replaceable>.<replaceable class="parameter">column_name</replaceable> | NONE } ] [ OWNED BY { <replaceable class="parameter">table_name</replaceable>.<replaceable class="parameter">column_name</replaceable> | NONE } ]
ALTER SEQUENCE [ IF EXISTS ] <replaceable class="parameter">name</replaceable> OWNER TO { <replaceable class="parameter">new_owner</replaceable> | CURRENT_USER | SESSION_USER } ALTER SEQUENCE [ IF EXISTS ] <replaceable class="parameter">name</replaceable> OWNER TO { <replaceable class="parameter">new_owner</replaceable> | CURRENT_ROLE | CURRENT_USER | SESSION_USER }
ALTER SEQUENCE [ IF EXISTS ] <replaceable class="parameter">name</replaceable> RENAME TO <replaceable class="parameter">new_name</replaceable> ALTER SEQUENCE [ IF EXISTS ] <replaceable class="parameter">name</replaceable> RENAME TO <replaceable class="parameter">new_name</replaceable>
ALTER SEQUENCE [ IF EXISTS ] <replaceable class="parameter">name</replaceable> SET SCHEMA <replaceable class="parameter">new_schema</replaceable> ALTER SEQUENCE [ IF EXISTS ] <replaceable class="parameter">name</replaceable> SET SCHEMA <replaceable class="parameter">new_schema</replaceable>
</synopsis> </synopsis>
......
...@@ -23,7 +23,7 @@ PostgreSQL documentation ...@@ -23,7 +23,7 @@ PostgreSQL documentation
<synopsis> <synopsis>
ALTER SERVER <replaceable class="parameter">name</replaceable> [ VERSION '<replaceable class="parameter">new_version</replaceable>' ] ALTER SERVER <replaceable class="parameter">name</replaceable> [ VERSION '<replaceable class="parameter">new_version</replaceable>' ]
[ OPTIONS ( [ ADD | SET | DROP ] <replaceable class="parameter">option</replaceable> ['<replaceable class="parameter">value</replaceable>'] [, ... ] ) ] [ OPTIONS ( [ ADD | SET | DROP ] <replaceable class="parameter">option</replaceable> ['<replaceable class="parameter">value</replaceable>'] [, ... ] ) ]
ALTER SERVER <replaceable class="parameter">name</replaceable> OWNER TO { <replaceable>new_owner</replaceable> | CURRENT_USER | SESSION_USER } ALTER SERVER <replaceable class="parameter">name</replaceable> OWNER TO { <replaceable>new_owner</replaceable> | CURRENT_ROLE | CURRENT_USER | SESSION_USER }
ALTER SERVER <replaceable class="parameter">name</replaceable> RENAME TO <replaceable>new_name</replaceable> ALTER SERVER <replaceable class="parameter">name</replaceable> RENAME TO <replaceable>new_name</replaceable>
</synopsis> </synopsis>
</refsynopsisdiv> </refsynopsisdiv>
......
...@@ -23,7 +23,7 @@ PostgreSQL documentation ...@@ -23,7 +23,7 @@ PostgreSQL documentation
<refsynopsisdiv> <refsynopsisdiv>
<synopsis> <synopsis>
ALTER STATISTICS <replaceable class="parameter">name</replaceable> OWNER TO { <replaceable class="parameter">new_owner</replaceable> | CURRENT_USER | SESSION_USER } ALTER STATISTICS <replaceable class="parameter">name</replaceable> OWNER TO { <replaceable class="parameter">new_owner</replaceable> | CURRENT_ROLE | CURRENT_USER | SESSION_USER }
ALTER STATISTICS <replaceable class="parameter">name</replaceable> RENAME TO <replaceable class="parameter">new_name</replaceable> ALTER STATISTICS <replaceable class="parameter">name</replaceable> RENAME TO <replaceable class="parameter">new_name</replaceable>
ALTER STATISTICS <replaceable class="parameter">name</replaceable> SET SCHEMA <replaceable class="parameter">new_schema</replaceable> ALTER STATISTICS <replaceable class="parameter">name</replaceable> SET SCHEMA <replaceable class="parameter">new_schema</replaceable>
ALTER STATISTICS <replaceable class="parameter">name</replaceable> SET STATISTICS <replaceable class="parameter">new_target</replaceable> ALTER STATISTICS <replaceable class="parameter">name</replaceable> SET STATISTICS <replaceable class="parameter">new_target</replaceable>
......
...@@ -27,7 +27,7 @@ ALTER SUBSCRIPTION <replaceable class="parameter">name</replaceable> REFRESH PUB ...@@ -27,7 +27,7 @@ ALTER SUBSCRIPTION <replaceable class="parameter">name</replaceable> REFRESH PUB
ALTER SUBSCRIPTION <replaceable class="parameter">name</replaceable> ENABLE ALTER SUBSCRIPTION <replaceable class="parameter">name</replaceable> ENABLE
ALTER SUBSCRIPTION <replaceable class="parameter">name</replaceable> DISABLE ALTER SUBSCRIPTION <replaceable class="parameter">name</replaceable> DISABLE
ALTER SUBSCRIPTION <replaceable class="parameter">name</replaceable> SET ( <replaceable class="parameter">subscription_parameter</replaceable> [= <replaceable class="parameter">value</replaceable>] [, ... ] ) ALTER SUBSCRIPTION <replaceable class="parameter">name</replaceable> SET ( <replaceable class="parameter">subscription_parameter</replaceable> [= <replaceable class="parameter">value</replaceable>] [, ... ] )
ALTER SUBSCRIPTION <replaceable class="parameter">name</replaceable> OWNER TO { <replaceable>new_owner</replaceable> | CURRENT_USER | SESSION_USER } ALTER SUBSCRIPTION <replaceable class="parameter">name</replaceable> OWNER TO { <replaceable>new_owner</replaceable> | CURRENT_ROLE | CURRENT_USER | SESSION_USER }
ALTER SUBSCRIPTION <replaceable class="parameter">name</replaceable> RENAME TO <replaceable>new_name</replaceable> ALTER SUBSCRIPTION <replaceable class="parameter">name</replaceable> RENAME TO <replaceable>new_name</replaceable>
</synopsis> </synopsis>
</refsynopsisdiv> </refsynopsisdiv>
......
...@@ -82,7 +82,7 @@ ALTER TABLE [ IF EXISTS ] <replaceable class="parameter">name</replaceable> ...@@ -82,7 +82,7 @@ ALTER TABLE [ IF EXISTS ] <replaceable class="parameter">name</replaceable>
NO INHERIT <replaceable class="parameter">parent_table</replaceable> NO INHERIT <replaceable class="parameter">parent_table</replaceable>
OF <replaceable class="parameter">type_name</replaceable> OF <replaceable class="parameter">type_name</replaceable>
NOT OF NOT OF
OWNER TO { <replaceable class="parameter">new_owner</replaceable> | CURRENT_USER | SESSION_USER } OWNER TO { <replaceable class="parameter">new_owner</replaceable> | CURRENT_ROLE | CURRENT_USER | SESSION_USER }
REPLICA IDENTITY { DEFAULT | USING INDEX <replaceable class="parameter">index_name</replaceable> | FULL | NOTHING } REPLICA IDENTITY { DEFAULT | USING INDEX <replaceable class="parameter">index_name</replaceable> | FULL | NOTHING }
<phrase>and <replaceable class="parameter">partition_bound_spec</replaceable> is:</phrase> <phrase>and <replaceable class="parameter">partition_bound_spec</replaceable> is:</phrase>
......
...@@ -22,7 +22,7 @@ PostgreSQL documentation ...@@ -22,7 +22,7 @@ PostgreSQL documentation
<refsynopsisdiv> <refsynopsisdiv>
<synopsis> <synopsis>
ALTER TABLESPACE <replaceable>name</replaceable> RENAME TO <replaceable>new_name</replaceable> ALTER TABLESPACE <replaceable>name</replaceable> RENAME TO <replaceable>new_name</replaceable>
ALTER TABLESPACE <replaceable>name</replaceable> OWNER TO { <replaceable>new_owner</replaceable> | CURRENT_USER | SESSION_USER } ALTER TABLESPACE <replaceable>name</replaceable> OWNER TO { <replaceable>new_owner</replaceable> | CURRENT_ROLE | CURRENT_USER | SESSION_USER }
ALTER TABLESPACE <replaceable>name</replaceable> SET ( <replaceable class="parameter">tablespace_option</replaceable> = <replaceable class="parameter">value</replaceable> [, ... ] ) ALTER TABLESPACE <replaceable>name</replaceable> SET ( <replaceable class="parameter">tablespace_option</replaceable> = <replaceable class="parameter">value</replaceable> [, ... ] )
ALTER TABLESPACE <replaceable>name</replaceable> RESET ( <replaceable class="parameter">tablespace_option</replaceable> [, ... ] ) ALTER TABLESPACE <replaceable>name</replaceable> RESET ( <replaceable class="parameter">tablespace_option</replaceable> [, ... ] )
</synopsis> </synopsis>
......
...@@ -32,7 +32,7 @@ ALTER TEXT SEARCH CONFIGURATION <replaceable>name</replaceable> ...@@ -32,7 +32,7 @@ ALTER TEXT SEARCH CONFIGURATION <replaceable>name</replaceable>
ALTER TEXT SEARCH CONFIGURATION <replaceable>name</replaceable> ALTER TEXT SEARCH CONFIGURATION <replaceable>name</replaceable>
DROP MAPPING [ IF EXISTS ] FOR <replaceable class="parameter">token_type</replaceable> [, ... ] DROP MAPPING [ IF EXISTS ] FOR <replaceable class="parameter">token_type</replaceable> [, ... ]
ALTER TEXT SEARCH CONFIGURATION <replaceable>name</replaceable> RENAME TO <replaceable>new_name</replaceable> ALTER TEXT SEARCH CONFIGURATION <replaceable>name</replaceable> RENAME TO <replaceable>new_name</replaceable>
ALTER TEXT SEARCH CONFIGURATION <replaceable>name</replaceable> OWNER TO { <replaceable>new_owner</replaceable> | CURRENT_USER | SESSION_USER } ALTER TEXT SEARCH CONFIGURATION <replaceable>name</replaceable> OWNER TO { <replaceable>new_owner</replaceable> | CURRENT_ROLE | CURRENT_USER | SESSION_USER }
ALTER TEXT SEARCH CONFIGURATION <replaceable>name</replaceable> SET SCHEMA <replaceable>new_schema</replaceable> ALTER TEXT SEARCH CONFIGURATION <replaceable>name</replaceable> SET SCHEMA <replaceable>new_schema</replaceable>
</synopsis> </synopsis>
</refsynopsisdiv> </refsynopsisdiv>
......
...@@ -25,7 +25,7 @@ ALTER TEXT SEARCH DICTIONARY <replaceable>name</replaceable> ( ...@@ -25,7 +25,7 @@ ALTER TEXT SEARCH DICTIONARY <replaceable>name</replaceable> (
<replaceable class="parameter">option</replaceable> [ = <replaceable class="parameter">value</replaceable> ] [, ... ] <replaceable class="parameter">option</replaceable> [ = <replaceable class="parameter">value</replaceable> ] [, ... ]
) )
ALTER TEXT SEARCH DICTIONARY <replaceable>name</replaceable> RENAME TO <replaceable>new_name</replaceable> ALTER TEXT SEARCH DICTIONARY <replaceable>name</replaceable> RENAME TO <replaceable>new_name</replaceable>
ALTER TEXT SEARCH DICTIONARY <replaceable>name</replaceable> OWNER TO { <replaceable>new_owner</replaceable> | CURRENT_USER | SESSION_USER } ALTER TEXT SEARCH DICTIONARY <replaceable>name</replaceable> OWNER TO { <replaceable>new_owner</replaceable> | CURRENT_ROLE | CURRENT_USER | SESSION_USER }
ALTER TEXT SEARCH DICTIONARY <replaceable>name</replaceable> SET SCHEMA <replaceable>new_schema</replaceable> ALTER TEXT SEARCH DICTIONARY <replaceable>name</replaceable> SET SCHEMA <replaceable>new_schema</replaceable>
</synopsis> </synopsis>
</refsynopsisdiv> </refsynopsisdiv>
......
...@@ -23,7 +23,7 @@ PostgreSQL documentation ...@@ -23,7 +23,7 @@ PostgreSQL documentation
<refsynopsisdiv> <refsynopsisdiv>
<synopsis> <synopsis>
ALTER TYPE <replaceable class="parameter">name</replaceable> OWNER TO { <replaceable class="parameter">new_owner</replaceable> | CURRENT_USER | SESSION_USER } ALTER TYPE <replaceable class="parameter">name</replaceable> OWNER TO { <replaceable class="parameter">new_owner</replaceable> | CURRENT_ROLE | CURRENT_USER | SESSION_USER }
ALTER TYPE <replaceable class="parameter">name</replaceable> RENAME TO <replaceable class="parameter">new_name</replaceable> ALTER TYPE <replaceable class="parameter">name</replaceable> RENAME TO <replaceable class="parameter">new_name</replaceable>
ALTER TYPE <replaceable class="parameter">name</replaceable> SET SCHEMA <replaceable class="parameter">new_schema</replaceable> ALTER TYPE <replaceable class="parameter">name</replaceable> SET SCHEMA <replaceable class="parameter">new_schema</replaceable>
ALTER TYPE <replaceable class="parameter">name</replaceable> RENAME ATTRIBUTE <replaceable class="parameter">attribute_name</replaceable> TO <replaceable class="parameter">new_attribute_name</replaceable> [ CASCADE | RESTRICT ] ALTER TYPE <replaceable class="parameter">name</replaceable> RENAME ATTRIBUTE <replaceable class="parameter">attribute_name</replaceable> TO <replaceable class="parameter">new_attribute_name</replaceable> [ CASCADE | RESTRICT ]
......
...@@ -46,6 +46,7 @@ ALTER USER { <replaceable class="parameter">role_specification</replaceable> | A ...@@ -46,6 +46,7 @@ ALTER USER { <replaceable class="parameter">role_specification</replaceable> | A
<phrase>where <replaceable class="parameter">role_specification</replaceable> can be:</phrase> <phrase>where <replaceable class="parameter">role_specification</replaceable> can be:</phrase>
<replaceable class="parameter">role_name</replaceable> <replaceable class="parameter">role_name</replaceable>
| CURRENT_ROLE
| CURRENT_USER | CURRENT_USER
| SESSION_USER | SESSION_USER
</synopsis> </synopsis>
......
...@@ -21,7 +21,7 @@ PostgreSQL documentation ...@@ -21,7 +21,7 @@ PostgreSQL documentation
<refsynopsisdiv> <refsynopsisdiv>
<synopsis> <synopsis>
ALTER USER MAPPING FOR { <replaceable class="parameter">user_name</replaceable> | USER | CURRENT_USER | SESSION_USER | PUBLIC } ALTER USER MAPPING FOR { <replaceable class="parameter">user_name</replaceable> | USER | CURRENT_ROLE | CURRENT_USER | SESSION_USER | PUBLIC }
SERVER <replaceable class="parameter">server_name</replaceable> SERVER <replaceable class="parameter">server_name</replaceable>
OPTIONS ( [ ADD | SET | DROP ] <replaceable class="parameter">option</replaceable> ['<replaceable class="parameter">value</replaceable>'] [, ... ] ) OPTIONS ( [ ADD | SET | DROP ] <replaceable class="parameter">option</replaceable> ['<replaceable class="parameter">value</replaceable>'] [, ... ] )
</synopsis> </synopsis>
...@@ -51,7 +51,7 @@ ALTER USER MAPPING FOR { <replaceable class="parameter">user_name</replaceable> ...@@ -51,7 +51,7 @@ ALTER USER MAPPING FOR { <replaceable class="parameter">user_name</replaceable>
<term><replaceable class="parameter">user_name</replaceable></term> <term><replaceable class="parameter">user_name</replaceable></term>
<listitem> <listitem>
<para> <para>
User name of the mapping. <literal>CURRENT_USER</literal> User name of the mapping. <literal>CURRENT_ROLE</literal>, <literal>CURRENT_USER</literal>,
and <literal>USER</literal> match the name of the current and <literal>USER</literal> match the name of the current
user. <literal>PUBLIC</literal> is used to match all present and future user. <literal>PUBLIC</literal> is used to match all present and future
user names in the system. user names in the system.
......
...@@ -23,7 +23,7 @@ PostgreSQL documentation ...@@ -23,7 +23,7 @@ PostgreSQL documentation
<synopsis> <synopsis>
ALTER VIEW [ IF EXISTS ] <replaceable class="parameter">name</replaceable> ALTER [ COLUMN ] <replaceable class="parameter">column_name</replaceable> SET DEFAULT <replaceable class="parameter">expression</replaceable> ALTER VIEW [ IF EXISTS ] <replaceable class="parameter">name</replaceable> ALTER [ COLUMN ] <replaceable class="parameter">column_name</replaceable> SET DEFAULT <replaceable class="parameter">expression</replaceable>
ALTER VIEW [ IF EXISTS ] <replaceable class="parameter">name</replaceable> ALTER [ COLUMN ] <replaceable class="parameter">column_name</replaceable> DROP DEFAULT ALTER VIEW [ IF EXISTS ] <replaceable class="parameter">name</replaceable> ALTER [ COLUMN ] <replaceable class="parameter">column_name</replaceable> DROP DEFAULT
ALTER VIEW [ IF EXISTS ] <replaceable class="parameter">name</replaceable> OWNER TO { <replaceable class="parameter">new_owner</replaceable> | CURRENT_USER | SESSION_USER } ALTER VIEW [ IF EXISTS ] <replaceable class="parameter">name</replaceable> OWNER TO { <replaceable class="parameter">new_owner</replaceable> | CURRENT_ROLE | CURRENT_USER | SESSION_USER }
ALTER VIEW [ IF EXISTS ] <replaceable class="parameter">name</replaceable> RENAME [ COLUMN ] <replaceable class="parameter">column_name</replaceable> TO <replaceable class="parameter">new_column_name</replaceable> ALTER VIEW [ IF EXISTS ] <replaceable class="parameter">name</replaceable> RENAME [ COLUMN ] <replaceable class="parameter">column_name</replaceable> TO <replaceable class="parameter">new_column_name</replaceable>
ALTER VIEW [ IF EXISTS ] <replaceable class="parameter">name</replaceable> RENAME TO <replaceable class="parameter">new_name</replaceable> ALTER VIEW [ IF EXISTS ] <replaceable class="parameter">name</replaceable> RENAME TO <replaceable class="parameter">new_name</replaceable>
ALTER VIEW [ IF EXISTS ] <replaceable class="parameter">name</replaceable> SET SCHEMA <replaceable class="parameter">new_schema</replaceable> ALTER VIEW [ IF EXISTS ] <replaceable class="parameter">name</replaceable> SET SCHEMA <replaceable class="parameter">new_schema</replaceable>
......
...@@ -24,7 +24,7 @@ PostgreSQL documentation ...@@ -24,7 +24,7 @@ PostgreSQL documentation
CREATE POLICY <replaceable class="parameter">name</replaceable> ON <replaceable class="parameter">table_name</replaceable> CREATE POLICY <replaceable class="parameter">name</replaceable> ON <replaceable class="parameter">table_name</replaceable>
[ AS { PERMISSIVE | RESTRICTIVE } ] [ AS { PERMISSIVE | RESTRICTIVE } ]
[ FOR { ALL | SELECT | INSERT | UPDATE | DELETE } ] [ FOR { ALL | SELECT | INSERT | UPDATE | DELETE } ]
[ TO { <replaceable class="parameter">role_name</replaceable> | PUBLIC | CURRENT_USER | SESSION_USER } [, ...] ] [ TO { <replaceable class="parameter">role_name</replaceable> | PUBLIC | CURRENT_ROLE | CURRENT_USER | SESSION_USER } [, ...] ]
[ USING ( <replaceable class="parameter">using_expression</replaceable> ) ] [ USING ( <replaceable class="parameter">using_expression</replaceable> ) ]
[ WITH CHECK ( <replaceable class="parameter">check_expression</replaceable> ) ] [ WITH CHECK ( <replaceable class="parameter">check_expression</replaceable> ) ]
</synopsis> </synopsis>
......
...@@ -29,6 +29,7 @@ CREATE SCHEMA IF NOT EXISTS AUTHORIZATION <replaceable class="parameter">role_sp ...@@ -29,6 +29,7 @@ CREATE SCHEMA IF NOT EXISTS AUTHORIZATION <replaceable class="parameter">role_sp
<phrase>where <replaceable class="parameter">role_specification</replaceable> can be:</phrase> <phrase>where <replaceable class="parameter">role_specification</replaceable> can be:</phrase>
<replaceable class="parameter">user_name</replaceable> <replaceable class="parameter">user_name</replaceable>
| CURRENT_ROLE
| CURRENT_USER | CURRENT_USER
| SESSION_USER | SESSION_USER
</synopsis> </synopsis>
......
...@@ -22,7 +22,7 @@ PostgreSQL documentation ...@@ -22,7 +22,7 @@ PostgreSQL documentation
<refsynopsisdiv> <refsynopsisdiv>
<synopsis> <synopsis>
CREATE TABLESPACE <replaceable class="parameter">tablespace_name</replaceable> CREATE TABLESPACE <replaceable class="parameter">tablespace_name</replaceable>
[ OWNER { <replaceable>new_owner</replaceable> | CURRENT_USER | SESSION_USER } ] [ OWNER { <replaceable>new_owner</replaceable> | CURRENT_ROLE | CURRENT_USER | SESSION_USER } ]
LOCATION '<replaceable class="parameter">directory</replaceable>' LOCATION '<replaceable class="parameter">directory</replaceable>'
[ WITH ( <replaceable class="parameter">tablespace_option</replaceable> = <replaceable class="parameter">value</replaceable> [, ... ] ) ] [ WITH ( <replaceable class="parameter">tablespace_option</replaceable> = <replaceable class="parameter">value</replaceable> [, ... ] ) ]
</synopsis> </synopsis>
......
...@@ -21,7 +21,7 @@ PostgreSQL documentation ...@@ -21,7 +21,7 @@ PostgreSQL documentation
<refsynopsisdiv> <refsynopsisdiv>
<synopsis> <synopsis>
CREATE USER MAPPING [ IF NOT EXISTS ] FOR { <replaceable class="parameter">user_name</replaceable> | USER | CURRENT_USER | PUBLIC } CREATE USER MAPPING [ IF NOT EXISTS ] FOR { <replaceable class="parameter">user_name</replaceable> | USER | CURRENT_ROLE | CURRENT_USER | PUBLIC }
SERVER <replaceable class="parameter">server_name</replaceable> SERVER <replaceable class="parameter">server_name</replaceable>
[ OPTIONS ( <replaceable class="parameter">option</replaceable> '<replaceable class="parameter">value</replaceable>' [ , ... ] ) ] [ OPTIONS ( <replaceable class="parameter">option</replaceable> '<replaceable class="parameter">value</replaceable>' [ , ... ] ) ]
</synopsis> </synopsis>
...@@ -67,7 +67,7 @@ CREATE USER MAPPING [ IF NOT EXISTS ] FOR { <replaceable class="parameter">user_ ...@@ -67,7 +67,7 @@ CREATE USER MAPPING [ IF NOT EXISTS ] FOR { <replaceable class="parameter">user_
<listitem> <listitem>
<para> <para>
The name of an existing user that is mapped to foreign server. The name of an existing user that is mapped to foreign server.
<literal>CURRENT_USER</literal> and <literal>USER</literal> match the name of <literal>CURRENT_ROLE</literal>, <literal>CURRENT_USER</literal>, and <literal>USER</literal> match the name of
the current user. When <literal>PUBLIC</literal> is specified, a the current user. When <literal>PUBLIC</literal> is specified, a
so-called public mapping is created that is used when no so-called public mapping is created that is used when no
user-specific mapping is applicable. user-specific mapping is applicable.
......
...@@ -21,7 +21,7 @@ PostgreSQL documentation ...@@ -21,7 +21,7 @@ PostgreSQL documentation
<refsynopsisdiv> <refsynopsisdiv>
<synopsis> <synopsis>
DROP OWNED BY { <replaceable class="parameter">name</replaceable> | CURRENT_USER | SESSION_USER } [, ...] [ CASCADE | RESTRICT ] DROP OWNED BY { <replaceable class="parameter">name</replaceable> | CURRENT_ROLE | CURRENT_USER | SESSION_USER } [, ...] [ CASCADE | RESTRICT ]
</synopsis> </synopsis>
</refsynopsisdiv> </refsynopsisdiv>
......
...@@ -21,7 +21,7 @@ PostgreSQL documentation ...@@ -21,7 +21,7 @@ PostgreSQL documentation
<refsynopsisdiv> <refsynopsisdiv>
<synopsis> <synopsis>
DROP USER MAPPING [ IF EXISTS ] FOR { <replaceable class="parameter">user_name</replaceable> | USER | CURRENT_USER | PUBLIC } SERVER <replaceable class="parameter">server_name</replaceable> DROP USER MAPPING [ IF EXISTS ] FOR { <replaceable class="parameter">user_name</replaceable> | USER | CURRENT_ROLE | CURRENT_USER | PUBLIC } SERVER <replaceable class="parameter">server_name</replaceable>
</synopsis> </synopsis>
</refsynopsisdiv> </refsynopsisdiv>
...@@ -59,7 +59,7 @@ DROP USER MAPPING [ IF EXISTS ] FOR { <replaceable class="parameter">user_name</ ...@@ -59,7 +59,7 @@ DROP USER MAPPING [ IF EXISTS ] FOR { <replaceable class="parameter">user_name</
<term><replaceable class="parameter">user_name</replaceable></term> <term><replaceable class="parameter">user_name</replaceable></term>
<listitem> <listitem>
<para> <para>
User name of the mapping. <literal>CURRENT_USER</literal> User name of the mapping. <literal>CURRENT_ROLE</literal>, <literal>CURRENT_USER</literal>,
and <literal>USER</literal> match the name of the current and <literal>USER</literal> match the name of the current
user. <literal>PUBLIC</literal> is used to match all present and user. <literal>PUBLIC</literal> is used to match all present and
future user names in the system. future user names in the system.
......
...@@ -87,6 +87,7 @@ GRANT <replaceable class="parameter">role_name</replaceable> [, ...] TO <replace ...@@ -87,6 +87,7 @@ GRANT <replaceable class="parameter">role_name</replaceable> [, ...] TO <replace
[ GROUP ] <replaceable class="parameter">role_name</replaceable> [ GROUP ] <replaceable class="parameter">role_name</replaceable>
| PUBLIC | PUBLIC
| CURRENT_ROLE
| CURRENT_USER | CURRENT_USER
| SESSION_USER | SESSION_USER
</synopsis> </synopsis>
......
...@@ -21,8 +21,8 @@ PostgreSQL documentation ...@@ -21,8 +21,8 @@ PostgreSQL documentation
<refsynopsisdiv> <refsynopsisdiv>
<synopsis> <synopsis>
REASSIGN OWNED BY { <replaceable class="parameter">old_role</replaceable> | CURRENT_USER | SESSION_USER } [, ...] REASSIGN OWNED BY { <replaceable class="parameter">old_role</replaceable> | CURRENT_ROLE | CURRENT_USER | SESSION_USER } [, ...]
TO { <replaceable class="parameter">new_role</replaceable> | CURRENT_USER | SESSION_USER } TO { <replaceable class="parameter">new_role</replaceable> | CURRENT_ROLE | CURRENT_USER | SESSION_USER }
</synopsis> </synopsis>
</refsynopsisdiv> </refsynopsisdiv>
......
...@@ -114,6 +114,7 @@ REVOKE [ ADMIN OPTION FOR ] ...@@ -114,6 +114,7 @@ REVOKE [ ADMIN OPTION FOR ]
[ GROUP ] <replaceable class="parameter">role_name</replaceable> [ GROUP ] <replaceable class="parameter">role_name</replaceable>
| PUBLIC | PUBLIC
| CURRENT_ROLE
| CURRENT_USER | CURRENT_USER
| SESSION_USER | SESSION_USER
</synopsis> </synopsis>
......
...@@ -14919,6 +14919,13 @@ RoleId: RoleSpec ...@@ -14919,6 +14919,13 @@ RoleId: RoleSpec
"CURRENT_USER"), "CURRENT_USER"),
parser_errposition(@1))); parser_errposition(@1)));
break; break;
case ROLESPEC_CURRENT_ROLE:
ereport(ERROR,
(errcode(ERRCODE_RESERVED_NAME),
errmsg("%s cannot be used as a role name here",
"CURRENT_ROLE"),
parser_errposition(@1)));
break;
} }
} }
; ;
...@@ -14950,6 +14957,10 @@ RoleSpec: NonReservedWord ...@@ -14950,6 +14957,10 @@ RoleSpec: NonReservedWord
} }
$$ = n; $$ = n;
} }
| CURRENT_ROLE
{
$$ = makeRoleSpec(ROLESPEC_CURRENT_ROLE, @1);
}
| CURRENT_USER | CURRENT_USER
{ {
$$ = makeRoleSpec(ROLESPEC_CURRENT_USER, @1); $$ = makeRoleSpec(ROLESPEC_CURRENT_USER, @1);
......
...@@ -5217,6 +5217,7 @@ get_rolespec_oid(const RoleSpec *role, bool missing_ok) ...@@ -5217,6 +5217,7 @@ get_rolespec_oid(const RoleSpec *role, bool missing_ok)
oid = get_role_oid(role->rolename, missing_ok); oid = get_role_oid(role->rolename, missing_ok);
break; break;
case ROLESPEC_CURRENT_ROLE:
case ROLESPEC_CURRENT_USER: case ROLESPEC_CURRENT_USER:
oid = GetUserId(); oid = GetUserId();
break; break;
...@@ -5259,6 +5260,7 @@ get_rolespec_tuple(const RoleSpec *role) ...@@ -5259,6 +5260,7 @@ get_rolespec_tuple(const RoleSpec *role)
errmsg("role \"%s\" does not exist", role->rolename))); errmsg("role \"%s\" does not exist", role->rolename)));
break; break;
case ROLESPEC_CURRENT_ROLE:
case ROLESPEC_CURRENT_USER: case ROLESPEC_CURRENT_USER:
tuple = SearchSysCache1(AUTHOID, GetUserId()); tuple = SearchSysCache1(AUTHOID, GetUserId());
if (!HeapTupleIsValid(tuple)) if (!HeapTupleIsValid(tuple))
......
...@@ -318,6 +318,7 @@ typedef struct CollateClause ...@@ -318,6 +318,7 @@ typedef struct CollateClause
typedef enum RoleSpecType typedef enum RoleSpecType
{ {
ROLESPEC_CSTRING, /* role name is stored as a C string */ ROLESPEC_CSTRING, /* role name is stored as a C string */
ROLESPEC_CURRENT_ROLE, /* role spec is CURRENT_ROLE */
ROLESPEC_CURRENT_USER, /* role spec is CURRENT_USER */ ROLESPEC_CURRENT_USER, /* role spec is CURRENT_USER */
ROLESPEC_SESSION_USER, /* role spec is SESSION_USER */ ROLESPEC_SESSION_USER, /* role spec is SESSION_USER */
ROLESPEC_PUBLIC /* role name is "public" */ ROLESPEC_PUBLIC /* role name is "public" */
......
...@@ -3,8 +3,10 @@ CREATE OR REPLACE FUNCTION chkrolattr() ...@@ -3,8 +3,10 @@ CREATE OR REPLACE FUNCTION chkrolattr()
AS $$ AS $$
SELECT r.rolname, v.keyword, r.rolcanlogin, r.rolreplication SELECT r.rolname, v.keyword, r.rolcanlogin, r.rolreplication
FROM pg_roles r FROM pg_roles r
JOIN (VALUES(CURRENT_USER, 'current_user'), JOIN (VALUES(CURRENT_ROLE, 'current_role'),
(CURRENT_USER, 'current_user'),
(SESSION_USER, 'session_user'), (SESSION_USER, 'session_user'),
('current_role', '-'),
('current_user', '-'), ('current_user', '-'),
('session_user', '-'), ('session_user', '-'),
('Public', '-'), ('Public', '-'),
...@@ -21,7 +23,8 @@ SELECT COALESCE(d.datname, 'ALL'), COALESCE(r.rolname, 'ALL'), ...@@ -21,7 +23,8 @@ SELECT COALESCE(d.datname, 'ALL'), COALESCE(r.rolname, 'ALL'),
FROM pg_db_role_setting s FROM pg_db_role_setting s
LEFT JOIN pg_roles r ON (r.oid = s.setrole) LEFT JOIN pg_roles r ON (r.oid = s.setrole)
LEFT JOIN pg_database d ON (d.oid = s.setdatabase) LEFT JOIN pg_database d ON (d.oid = s.setdatabase)
LEFT JOIN (VALUES(CURRENT_USER, 'current_user'), LEFT JOIN (VALUES(CURRENT_ROLE, 'current_role'),
(CURRENT_USER, 'current_user'),
(SESSION_USER, 'session_user')) (SESSION_USER, 'session_user'))
AS v(uname, keyword) AS v(uname, keyword)
ON (r.rolname = v.uname) ON (r.rolname = v.uname)
...@@ -46,6 +49,7 @@ $$ LANGUAGE SQL; ...@@ -46,6 +49,7 @@ $$ LANGUAGE SQL;
SET client_min_messages = ERROR; SET client_min_messages = ERROR;
CREATE ROLE "Public"; CREATE ROLE "Public";
CREATE ROLE "None"; CREATE ROLE "None";
CREATE ROLE "current_role";
CREATE ROLE "current_user"; CREATE ROLE "current_user";
CREATE ROLE "session_user"; CREATE ROLE "session_user";
CREATE ROLE "user"; CREATE ROLE "user";
...@@ -55,7 +59,7 @@ ERROR: CURRENT_USER cannot be used as a role name here ...@@ -55,7 +59,7 @@ ERROR: CURRENT_USER cannot be used as a role name here
LINE 1: CREATE ROLE current_user; LINE 1: CREATE ROLE current_user;
^ ^
CREATE ROLE current_role; -- error CREATE ROLE current_role; -- error
ERROR: syntax error at or near "current_role" ERROR: CURRENT_ROLE cannot be used as a role name here
LINE 1: CREATE ROLE current_role; LINE 1: CREATE ROLE current_role;
^ ^
CREATE ROLE session_user; -- error CREATE ROLE session_user; -- error
...@@ -112,23 +116,56 @@ SELECT * FROM chkrolattr(); ...@@ -112,23 +116,56 @@ SELECT * FROM chkrolattr();
------------------+--------------+----------+------------- ------------------+--------------+----------+-------------
None | - | f | f None | - | f | f
Public | - | f | f Public | - | f | f
current_role | - | f | f
current_user | - | f | f current_user | - | f | f
regress_testrol1 | session_user | t | f regress_testrol1 | session_user | t | f
regress_testrol2 | current_role | f | f
regress_testrol2 | current_user | f | f regress_testrol2 | current_user | f | f
session_user | - | f | f session_user | - | f | f
(6 rows) (8 rows)
ALTER ROLE CURRENT_ROLE WITH REPLICATION;
SELECT * FROM chkrolattr();
role | rolekeyword | canlogin | replication
------------------+--------------+----------+-------------
None | - | f | f
Public | - | f | f
current_role | - | f | f
current_user | - | f | f
regress_testrol1 | session_user | t | f
regress_testrol2 | current_role | f | t
regress_testrol2 | current_user | f | t
session_user | - | f | f
(8 rows)
ALTER ROLE "current_role" WITH REPLICATION;
SELECT * FROM chkrolattr();
role | rolekeyword | canlogin | replication
------------------+--------------+----------+-------------
None | - | f | f
Public | - | f | f
current_role | - | f | t
current_user | - | f | f
regress_testrol1 | session_user | t | f
regress_testrol2 | current_role | f | t
regress_testrol2 | current_user | f | t
session_user | - | f | f
(8 rows)
ALTER ROLE CURRENT_ROLE WITH NOREPLICATION;
ALTER ROLE CURRENT_USER WITH REPLICATION; ALTER ROLE CURRENT_USER WITH REPLICATION;
SELECT * FROM chkrolattr(); SELECT * FROM chkrolattr();
role | rolekeyword | canlogin | replication role | rolekeyword | canlogin | replication
------------------+--------------+----------+------------- ------------------+--------------+----------+-------------
None | - | f | f None | - | f | f
Public | - | f | f Public | - | f | f
current_role | - | f | t
current_user | - | f | f current_user | - | f | f
regress_testrol1 | session_user | t | f regress_testrol1 | session_user | t | f
regress_testrol2 | current_role | f | t
regress_testrol2 | current_user | f | t regress_testrol2 | current_user | f | t
session_user | - | f | f session_user | - | f | f
(6 rows) (8 rows)
ALTER ROLE "current_user" WITH REPLICATION; ALTER ROLE "current_user" WITH REPLICATION;
SELECT * FROM chkrolattr(); SELECT * FROM chkrolattr();
...@@ -136,11 +173,13 @@ SELECT * FROM chkrolattr(); ...@@ -136,11 +173,13 @@ SELECT * FROM chkrolattr();
------------------+--------------+----------+------------- ------------------+--------------+----------+-------------
None | - | f | f None | - | f | f
Public | - | f | f Public | - | f | f
current_role | - | f | t
current_user | - | f | t current_user | - | f | t
regress_testrol1 | session_user | t | f regress_testrol1 | session_user | t | f
regress_testrol2 | current_role | f | t
regress_testrol2 | current_user | f | t regress_testrol2 | current_user | f | t
session_user | - | f | f session_user | - | f | f
(6 rows) (8 rows)
ALTER ROLE SESSION_USER WITH REPLICATION; ALTER ROLE SESSION_USER WITH REPLICATION;
SELECT * FROM chkrolattr(); SELECT * FROM chkrolattr();
...@@ -148,11 +187,13 @@ SELECT * FROM chkrolattr(); ...@@ -148,11 +187,13 @@ SELECT * FROM chkrolattr();
------------------+--------------+----------+------------- ------------------+--------------+----------+-------------
None | - | f | f None | - | f | f
Public | - | f | f Public | - | f | f
current_role | - | f | t
current_user | - | f | t current_user | - | f | t
regress_testrol1 | session_user | t | t regress_testrol1 | session_user | t | t
regress_testrol2 | current_role | f | t
regress_testrol2 | current_user | f | t regress_testrol2 | current_user | f | t
session_user | - | f | f session_user | - | f | f
(6 rows) (8 rows)
ALTER ROLE "session_user" WITH REPLICATION; ALTER ROLE "session_user" WITH REPLICATION;
SELECT * FROM chkrolattr(); SELECT * FROM chkrolattr();
...@@ -160,11 +201,13 @@ SELECT * FROM chkrolattr(); ...@@ -160,11 +201,13 @@ SELECT * FROM chkrolattr();
------------------+--------------+----------+------------- ------------------+--------------+----------+-------------
None | - | f | f None | - | f | f
Public | - | f | f Public | - | f | f
current_role | - | f | t
current_user | - | f | t current_user | - | f | t
regress_testrol1 | session_user | t | t regress_testrol1 | session_user | t | t
regress_testrol2 | current_role | f | t
regress_testrol2 | current_user | f | t regress_testrol2 | current_user | f | t
session_user | - | f | t session_user | - | f | t
(6 rows) (8 rows)
ALTER USER "Public" WITH REPLICATION; ALTER USER "Public" WITH REPLICATION;
ALTER USER "None" WITH REPLICATION; ALTER USER "None" WITH REPLICATION;
...@@ -173,11 +216,13 @@ SELECT * FROM chkrolattr(); ...@@ -173,11 +216,13 @@ SELECT * FROM chkrolattr();
------------------+--------------+----------+------------- ------------------+--------------+----------+-------------
None | - | f | t None | - | f | t
Public | - | f | t Public | - | f | t
current_role | - | f | t
current_user | - | f | t current_user | - | f | t
regress_testrol1 | session_user | t | t regress_testrol1 | session_user | t | t
regress_testrol2 | current_role | f | t
regress_testrol2 | current_user | f | t regress_testrol2 | current_user | f | t
session_user | - | f | t session_user | - | f | t
(6 rows) (8 rows)
ALTER USER regress_testrol1 WITH NOREPLICATION; ALTER USER regress_testrol1 WITH NOREPLICATION;
ALTER USER regress_testrol2 WITH NOREPLICATION; ALTER USER regress_testrol2 WITH NOREPLICATION;
...@@ -186,21 +231,19 @@ SELECT * FROM chkrolattr(); ...@@ -186,21 +231,19 @@ SELECT * FROM chkrolattr();
------------------+--------------+----------+------------- ------------------+--------------+----------+-------------
None | - | f | t None | - | f | t
Public | - | f | t Public | - | f | t
current_role | - | f | t
current_user | - | f | t current_user | - | f | t
regress_testrol1 | session_user | t | f regress_testrol1 | session_user | t | f
regress_testrol2 | current_role | f | f
regress_testrol2 | current_user | f | f regress_testrol2 | current_user | f | f
session_user | - | f | t session_user | - | f | t
(6 rows) (8 rows)
ROLLBACK; ROLLBACK;
ALTER ROLE USER WITH LOGIN; -- error ALTER ROLE USER WITH LOGIN; -- error
ERROR: syntax error at or near "USER" ERROR: syntax error at or near "USER"
LINE 1: ALTER ROLE USER WITH LOGIN; LINE 1: ALTER ROLE USER WITH LOGIN;
^ ^
ALTER ROLE CURRENT_ROLE WITH LOGIN; --error
ERROR: syntax error at or near "CURRENT_ROLE"
LINE 1: ALTER ROLE CURRENT_ROLE WITH LOGIN;
^
ALTER ROLE ALL WITH REPLICATION; -- error ALTER ROLE ALL WITH REPLICATION; -- error
ERROR: syntax error at or near "WITH" ERROR: syntax error at or near "WITH"
LINE 1: ALTER ROLE ALL WITH REPLICATION; LINE 1: ALTER ROLE ALL WITH REPLICATION;
...@@ -228,23 +271,56 @@ SELECT * FROM chkrolattr(); ...@@ -228,23 +271,56 @@ SELECT * FROM chkrolattr();
------------------+--------------+----------+------------- ------------------+--------------+----------+-------------
None | - | f | f None | - | f | f
Public | - | f | f Public | - | f | f
current_role | - | f | f
current_user | - | f | f current_user | - | f | f
regress_testrol1 | session_user | t | f regress_testrol1 | session_user | t | f
regress_testrol2 | current_role | f | f
regress_testrol2 | current_user | f | f regress_testrol2 | current_user | f | f
session_user | - | f | f session_user | - | f | f
(6 rows) (8 rows)
ALTER USER CURRENT_ROLE WITH REPLICATION;
SELECT * FROM chkrolattr();
role | rolekeyword | canlogin | replication
------------------+--------------+----------+-------------
None | - | f | f
Public | - | f | f
current_role | - | f | f
current_user | - | f | f
regress_testrol1 | session_user | t | f
regress_testrol2 | current_role | f | t
regress_testrol2 | current_user | f | t
session_user | - | f | f
(8 rows)
ALTER USER "current_role" WITH REPLICATION;
SELECT * FROM chkrolattr();
role | rolekeyword | canlogin | replication
------------------+--------------+----------+-------------
None | - | f | f
Public | - | f | f
current_role | - | f | t
current_user | - | f | f
regress_testrol1 | session_user | t | f
regress_testrol2 | current_role | f | t
regress_testrol2 | current_user | f | t
session_user | - | f | f
(8 rows)
ALTER USER CURRENT_ROLE WITH NOREPLICATION;
ALTER USER CURRENT_USER WITH REPLICATION; ALTER USER CURRENT_USER WITH REPLICATION;
SELECT * FROM chkrolattr(); SELECT * FROM chkrolattr();
role | rolekeyword | canlogin | replication role | rolekeyword | canlogin | replication
------------------+--------------+----------+------------- ------------------+--------------+----------+-------------
None | - | f | f None | - | f | f
Public | - | f | f Public | - | f | f
current_role | - | f | t
current_user | - | f | f current_user | - | f | f
regress_testrol1 | session_user | t | f regress_testrol1 | session_user | t | f
regress_testrol2 | current_role | f | t
regress_testrol2 | current_user | f | t regress_testrol2 | current_user | f | t
session_user | - | f | f session_user | - | f | f
(6 rows) (8 rows)
ALTER USER "current_user" WITH REPLICATION; ALTER USER "current_user" WITH REPLICATION;
SELECT * FROM chkrolattr(); SELECT * FROM chkrolattr();
...@@ -252,11 +328,13 @@ SELECT * FROM chkrolattr(); ...@@ -252,11 +328,13 @@ SELECT * FROM chkrolattr();
------------------+--------------+----------+------------- ------------------+--------------+----------+-------------
None | - | f | f None | - | f | f
Public | - | f | f Public | - | f | f
current_role | - | f | t
current_user | - | f | t current_user | - | f | t
regress_testrol1 | session_user | t | f regress_testrol1 | session_user | t | f
regress_testrol2 | current_role | f | t
regress_testrol2 | current_user | f | t regress_testrol2 | current_user | f | t
session_user | - | f | f session_user | - | f | f
(6 rows) (8 rows)
ALTER USER SESSION_USER WITH REPLICATION; ALTER USER SESSION_USER WITH REPLICATION;
SELECT * FROM chkrolattr(); SELECT * FROM chkrolattr();
...@@ -264,11 +342,13 @@ SELECT * FROM chkrolattr(); ...@@ -264,11 +342,13 @@ SELECT * FROM chkrolattr();
------------------+--------------+----------+------------- ------------------+--------------+----------+-------------
None | - | f | f None | - | f | f
Public | - | f | f Public | - | f | f
current_role | - | f | t
current_user | - | f | t current_user | - | f | t
regress_testrol1 | session_user | t | t regress_testrol1 | session_user | t | t
regress_testrol2 | current_role | f | t
regress_testrol2 | current_user | f | t regress_testrol2 | current_user | f | t
session_user | - | f | f session_user | - | f | f
(6 rows) (8 rows)
ALTER USER "session_user" WITH REPLICATION; ALTER USER "session_user" WITH REPLICATION;
SELECT * FROM chkrolattr(); SELECT * FROM chkrolattr();
...@@ -276,11 +356,13 @@ SELECT * FROM chkrolattr(); ...@@ -276,11 +356,13 @@ SELECT * FROM chkrolattr();
------------------+--------------+----------+------------- ------------------+--------------+----------+-------------
None | - | f | f None | - | f | f
Public | - | f | f Public | - | f | f
current_role | - | f | t
current_user | - | f | t current_user | - | f | t
regress_testrol1 | session_user | t | t regress_testrol1 | session_user | t | t
regress_testrol2 | current_role | f | t
regress_testrol2 | current_user | f | t regress_testrol2 | current_user | f | t
session_user | - | f | t session_user | - | f | t
(6 rows) (8 rows)
ALTER USER "Public" WITH REPLICATION; ALTER USER "Public" WITH REPLICATION;
ALTER USER "None" WITH REPLICATION; ALTER USER "None" WITH REPLICATION;
...@@ -289,11 +371,13 @@ SELECT * FROM chkrolattr(); ...@@ -289,11 +371,13 @@ SELECT * FROM chkrolattr();
------------------+--------------+----------+------------- ------------------+--------------+----------+-------------
None | - | f | t None | - | f | t
Public | - | f | t Public | - | f | t
current_role | - | f | t
current_user | - | f | t current_user | - | f | t
regress_testrol1 | session_user | t | t regress_testrol1 | session_user | t | t
regress_testrol2 | current_role | f | t
regress_testrol2 | current_user | f | t regress_testrol2 | current_user | f | t
session_user | - | f | t session_user | - | f | t
(6 rows) (8 rows)
ALTER USER regress_testrol1 WITH NOREPLICATION; ALTER USER regress_testrol1 WITH NOREPLICATION;
ALTER USER regress_testrol2 WITH NOREPLICATION; ALTER USER regress_testrol2 WITH NOREPLICATION;
...@@ -302,21 +386,19 @@ SELECT * FROM chkrolattr(); ...@@ -302,21 +386,19 @@ SELECT * FROM chkrolattr();
------------------+--------------+----------+------------- ------------------+--------------+----------+-------------
None | - | f | t None | - | f | t
Public | - | f | t Public | - | f | t
current_role | - | f | t
current_user | - | f | t current_user | - | f | t
regress_testrol1 | session_user | t | f regress_testrol1 | session_user | t | f
regress_testrol2 | current_role | f | f
regress_testrol2 | current_user | f | f regress_testrol2 | current_user | f | f
session_user | - | f | t session_user | - | f | t
(6 rows) (8 rows)
ROLLBACK; ROLLBACK;
ALTER USER USER WITH LOGIN; -- error ALTER USER USER WITH LOGIN; -- error
ERROR: syntax error at or near "USER" ERROR: syntax error at or near "USER"
LINE 1: ALTER USER USER WITH LOGIN; LINE 1: ALTER USER USER WITH LOGIN;
^ ^
ALTER USER CURRENT_ROLE WITH LOGIN; -- error
ERROR: syntax error at or near "CURRENT_ROLE"
LINE 1: ALTER USER CURRENT_ROLE WITH LOGIN;
^
ALTER USER ALL WITH REPLICATION; -- error ALTER USER ALL WITH REPLICATION; -- error
ERROR: syntax error at or near "WITH" ERROR: syntax error at or near "WITH"
LINE 1: ALTER USER ALL WITH REPLICATION; LINE 1: ALTER USER ALL WITH REPLICATION;
...@@ -343,6 +425,7 @@ SELECT * FROM chksetconfig(); ...@@ -343,6 +425,7 @@ SELECT * FROM chksetconfig();
----+------+------------+----------- ----+------+------------+-----------
(0 rows) (0 rows)
ALTER ROLE CURRENT_ROLE SET application_name to 'BAZ';
ALTER ROLE CURRENT_USER SET application_name to 'FOO'; ALTER ROLE CURRENT_USER SET application_name to 'FOO';
ALTER ROLE SESSION_USER SET application_name to 'BAR'; ALTER ROLE SESSION_USER SET application_name to 'BAR';
ALTER ROLE "current_user" SET application_name to 'FOOFOO'; ALTER ROLE "current_user" SET application_name to 'FOOFOO';
...@@ -355,7 +438,8 @@ SELECT * FROM chksetconfig(); ...@@ -355,7 +438,8 @@ SELECT * FROM chksetconfig();
ALL | current_user | - | {application_name=FOOFOO} ALL | current_user | - | {application_name=FOOFOO}
ALL | regress_testrol1 | session_user | {application_name=BAR} ALL | regress_testrol1 | session_user | {application_name=BAR}
ALL | regress_testrol2 | current_user | {application_name=FOO} ALL | regress_testrol2 | current_user | {application_name=FOO}
(4 rows) ALL | regress_testrol2 | current_role | {application_name=FOO}
(5 rows)
ALTER ROLE regress_testrol1 SET application_name to 'SLAM'; ALTER ROLE regress_testrol1 SET application_name to 'SLAM';
SELECT * FROM chksetconfig(); SELECT * FROM chksetconfig();
...@@ -365,8 +449,10 @@ SELECT * FROM chksetconfig(); ...@@ -365,8 +449,10 @@ SELECT * FROM chksetconfig();
ALL | current_user | - | {application_name=FOOFOO} ALL | current_user | - | {application_name=FOOFOO}
ALL | regress_testrol1 | session_user | {application_name=SLAM} ALL | regress_testrol1 | session_user | {application_name=SLAM}
ALL | regress_testrol2 | current_user | {application_name=FOO} ALL | regress_testrol2 | current_user | {application_name=FOO}
(4 rows) ALL | regress_testrol2 | current_role | {application_name=FOO}
(5 rows)
ALTER ROLE CURRENT_ROLE RESET application_name;
ALTER ROLE CURRENT_USER RESET application_name; ALTER ROLE CURRENT_USER RESET application_name;
ALTER ROLE SESSION_USER RESET application_name; ALTER ROLE SESSION_USER RESET application_name;
ALTER ROLE "current_user" RESET application_name; ALTER ROLE "current_user" RESET application_name;
...@@ -377,10 +463,6 @@ SELECT * FROM chksetconfig(); ...@@ -377,10 +463,6 @@ SELECT * FROM chksetconfig();
----+------+------------+----------- ----+------+------------+-----------
(0 rows) (0 rows)
ALTER ROLE CURRENT_ROLE SET application_name to 'BAZ'; -- error
ERROR: syntax error at or near "CURRENT_ROLE"
LINE 1: ALTER ROLE CURRENT_ROLE SET application_name to 'BAZ';
^
ALTER ROLE USER SET application_name to 'BOOM'; -- error ALTER ROLE USER SET application_name to 'BOOM'; -- error
ERROR: syntax error at or near "USER" ERROR: syntax error at or near "USER"
LINE 1: ALTER ROLE USER SET application_name to 'BOOM'; LINE 1: ALTER ROLE USER SET application_name to 'BOOM';
...@@ -395,6 +477,7 @@ SELECT * FROM chksetconfig(); ...@@ -395,6 +477,7 @@ SELECT * FROM chksetconfig();
----+------+------------+----------- ----+------+------------+-----------
(0 rows) (0 rows)
ALTER USER CURRENT_ROLE SET application_name to 'BAZ';
ALTER USER CURRENT_USER SET application_name to 'FOO'; ALTER USER CURRENT_USER SET application_name to 'FOO';
ALTER USER SESSION_USER SET application_name to 'BAR'; ALTER USER SESSION_USER SET application_name to 'BAR';
ALTER USER "current_user" SET application_name to 'FOOFOO'; ALTER USER "current_user" SET application_name to 'FOOFOO';
...@@ -407,7 +490,8 @@ SELECT * FROM chksetconfig(); ...@@ -407,7 +490,8 @@ SELECT * FROM chksetconfig();
ALL | current_user | - | {application_name=FOOFOO} ALL | current_user | - | {application_name=FOOFOO}
ALL | regress_testrol1 | session_user | {application_name=BAR} ALL | regress_testrol1 | session_user | {application_name=BAR}
ALL | regress_testrol2 | current_user | {application_name=FOO} ALL | regress_testrol2 | current_user | {application_name=FOO}
(4 rows) ALL | regress_testrol2 | current_role | {application_name=FOO}
(5 rows)
ALTER USER regress_testrol1 SET application_name to 'SLAM'; ALTER USER regress_testrol1 SET application_name to 'SLAM';
SELECT * FROM chksetconfig(); SELECT * FROM chksetconfig();
...@@ -417,8 +501,10 @@ SELECT * FROM chksetconfig(); ...@@ -417,8 +501,10 @@ SELECT * FROM chksetconfig();
ALL | current_user | - | {application_name=FOOFOO} ALL | current_user | - | {application_name=FOOFOO}
ALL | regress_testrol1 | session_user | {application_name=SLAM} ALL | regress_testrol1 | session_user | {application_name=SLAM}
ALL | regress_testrol2 | current_user | {application_name=FOO} ALL | regress_testrol2 | current_user | {application_name=FOO}
(4 rows) ALL | regress_testrol2 | current_role | {application_name=FOO}
(5 rows)
ALTER USER CURRENT_ROLE RESET application_name;
ALTER USER CURRENT_USER RESET application_name; ALTER USER CURRENT_USER RESET application_name;
ALTER USER SESSION_USER RESET application_name; ALTER USER SESSION_USER RESET application_name;
ALTER USER "current_user" RESET application_name; ALTER USER "current_user" RESET application_name;
...@@ -429,10 +515,6 @@ SELECT * FROM chksetconfig(); ...@@ -429,10 +515,6 @@ SELECT * FROM chksetconfig();
----+------+------------+----------- ----+------+------------+-----------
(0 rows) (0 rows)
ALTER USER CURRENT_ROLE SET application_name to 'BAZ'; -- error
ERROR: syntax error at or near "CURRENT_ROLE"
LINE 1: ALTER USER CURRENT_ROLE SET application_name to 'BAZ';
^
ALTER USER USER SET application_name to 'BOOM'; -- error ALTER USER USER SET application_name to 'BOOM'; -- error
ERROR: syntax error at or near "USER" ERROR: syntax error at or near "USER"
LINE 1: ALTER USER USER SET application_name to 'BOOM'; LINE 1: ALTER USER USER SET application_name to 'BOOM';
...@@ -448,26 +530,23 @@ ERROR: role "nonexistent" does not exist ...@@ -448,26 +530,23 @@ ERROR: role "nonexistent" does not exist
-- CREATE SCHEMA -- CREATE SCHEMA
CREATE SCHEMA newschema1 AUTHORIZATION CURRENT_USER; CREATE SCHEMA newschema1 AUTHORIZATION CURRENT_USER;
CREATE SCHEMA newschema2 AUTHORIZATION "current_user"; CREATE SCHEMA newschema2 AUTHORIZATION "current_user";
CREATE SCHEMA newschema3 AUTHORIZATION SESSION_USER; CREATE SCHEMA newschema3 AUTHORIZATION CURRENT_ROLE;
CREATE SCHEMA newschema4 AUTHORIZATION regress_testrolx; CREATE SCHEMA newschema4 AUTHORIZATION SESSION_USER;
CREATE SCHEMA newschema5 AUTHORIZATION "Public"; CREATE SCHEMA newschema5 AUTHORIZATION regress_testrolx;
CREATE SCHEMA newschema6 AUTHORIZATION USER; -- error CREATE SCHEMA newschema6 AUTHORIZATION "Public";
CREATE SCHEMA newschemax AUTHORIZATION USER; -- error
ERROR: syntax error at or near "USER" ERROR: syntax error at or near "USER"
LINE 1: CREATE SCHEMA newschema6 AUTHORIZATION USER; LINE 1: CREATE SCHEMA newschemax AUTHORIZATION USER;
^ ^
CREATE SCHEMA newschema6 AUTHORIZATION CURRENT_ROLE; -- error CREATE SCHEMA newschemax AUTHORIZATION PUBLIC; -- error
ERROR: syntax error at or near "CURRENT_ROLE"
LINE 1: CREATE SCHEMA newschema6 AUTHORIZATION CURRENT_ROLE;
^
CREATE SCHEMA newschema6 AUTHORIZATION PUBLIC; -- error
ERROR: role "public" does not exist ERROR: role "public" does not exist
CREATE SCHEMA newschema6 AUTHORIZATION "public"; -- error CREATE SCHEMA newschemax AUTHORIZATION "public"; -- error
ERROR: role "public" does not exist ERROR: role "public" does not exist
CREATE SCHEMA newschema6 AUTHORIZATION NONE; -- error CREATE SCHEMA newschemax AUTHORIZATION NONE; -- error
ERROR: role name "none" is reserved ERROR: role name "none" is reserved
LINE 1: CREATE SCHEMA newschema6 AUTHORIZATION NONE; LINE 1: CREATE SCHEMA newschemax AUTHORIZATION NONE;
^ ^
CREATE SCHEMA newschema6 AUTHORIZATION nonexistent; -- error CREATE SCHEMA newschemax AUTHORIZATION nonexistent; -- error
ERROR: role "nonexistent" does not exist ERROR: role "nonexistent" does not exist
SELECT n.nspname, r.rolname FROM pg_namespace n SELECT n.nspname, r.rolname FROM pg_namespace n
JOIN pg_roles r ON (r.oid = n.nspowner) JOIN pg_roles r ON (r.oid = n.nspowner)
...@@ -476,38 +555,37 @@ SELECT n.nspname, r.rolname FROM pg_namespace n ...@@ -476,38 +555,37 @@ SELECT n.nspname, r.rolname FROM pg_namespace n
------------+------------------ ------------+------------------
newschema1 | regress_testrol2 newschema1 | regress_testrol2
newschema2 | current_user newschema2 | current_user
newschema3 | regress_testrol1 newschema3 | regress_testrol2
newschema4 | regress_testrolx newschema4 | regress_testrol1
newschema5 | Public newschema5 | regress_testrolx
(5 rows) newschema6 | Public
(6 rows)
CREATE SCHEMA IF NOT EXISTS newschema1 AUTHORIZATION CURRENT_USER; CREATE SCHEMA IF NOT EXISTS newschema1 AUTHORIZATION CURRENT_USER;
NOTICE: schema "newschema1" already exists, skipping NOTICE: schema "newschema1" already exists, skipping
CREATE SCHEMA IF NOT EXISTS newschema2 AUTHORIZATION "current_user"; CREATE SCHEMA IF NOT EXISTS newschema2 AUTHORIZATION "current_user";
NOTICE: schema "newschema2" already exists, skipping NOTICE: schema "newschema2" already exists, skipping
CREATE SCHEMA IF NOT EXISTS newschema3 AUTHORIZATION SESSION_USER; CREATE SCHEMA IF NOT EXISTS newschema3 AUTHORIZATION CURRENT_ROLE;
NOTICE: schema "newschema3" already exists, skipping NOTICE: schema "newschema3" already exists, skipping
CREATE SCHEMA IF NOT EXISTS newschema4 AUTHORIZATION regress_testrolx; CREATE SCHEMA IF NOT EXISTS newschema4 AUTHORIZATION SESSION_USER;
NOTICE: schema "newschema4" already exists, skipping NOTICE: schema "newschema4" already exists, skipping
CREATE SCHEMA IF NOT EXISTS newschema5 AUTHORIZATION "Public"; CREATE SCHEMA IF NOT EXISTS newschema5 AUTHORIZATION regress_testrolx;
NOTICE: schema "newschema5" already exists, skipping NOTICE: schema "newschema5" already exists, skipping
CREATE SCHEMA IF NOT EXISTS newschema6 AUTHORIZATION USER; -- error CREATE SCHEMA IF NOT EXISTS newschema6 AUTHORIZATION "Public";
NOTICE: schema "newschema6" already exists, skipping
CREATE SCHEMA IF NOT EXISTS newschemax AUTHORIZATION USER; -- error
ERROR: syntax error at or near "USER" ERROR: syntax error at or near "USER"
LINE 1: CREATE SCHEMA IF NOT EXISTS newschema6 AUTHORIZATION USER; LINE 1: CREATE SCHEMA IF NOT EXISTS newschemax AUTHORIZATION USER;
^
CREATE SCHEMA IF NOT EXISTS newschema6 AUTHORIZATION CURRENT_ROLE; -- error
ERROR: syntax error at or near "CURRENT_ROLE"
LINE 1: ...ATE SCHEMA IF NOT EXISTS newschema6 AUTHORIZATION CURRENT_RO...
^ ^
CREATE SCHEMA IF NOT EXISTS newschema6 AUTHORIZATION PUBLIC; -- error CREATE SCHEMA IF NOT EXISTS newschemax AUTHORIZATION PUBLIC; -- error
ERROR: role "public" does not exist ERROR: role "public" does not exist
CREATE SCHEMA IF NOT EXISTS newschema6 AUTHORIZATION "public"; -- error CREATE SCHEMA IF NOT EXISTS newschemax AUTHORIZATION "public"; -- error
ERROR: role "public" does not exist ERROR: role "public" does not exist
CREATE SCHEMA IF NOT EXISTS newschema6 AUTHORIZATION NONE; -- error CREATE SCHEMA IF NOT EXISTS newschemax AUTHORIZATION NONE; -- error
ERROR: role name "none" is reserved ERROR: role name "none" is reserved
LINE 1: CREATE SCHEMA IF NOT EXISTS newschema6 AUTHORIZATION NONE; LINE 1: CREATE SCHEMA IF NOT EXISTS newschemax AUTHORIZATION NONE;
^ ^
CREATE SCHEMA IF NOT EXISTS newschema6 AUTHORIZATION nonexistent; -- error CREATE SCHEMA IF NOT EXISTS newschemax AUTHORIZATION nonexistent; -- error
ERROR: role "nonexistent" does not exist ERROR: role "nonexistent" does not exist
SELECT n.nspname, r.rolname FROM pg_namespace n SELECT n.nspname, r.rolname FROM pg_namespace n
JOIN pg_roles r ON (r.oid = n.nspowner) JOIN pg_roles r ON (r.oid = n.nspowner)
...@@ -516,10 +594,11 @@ SELECT n.nspname, r.rolname FROM pg_namespace n ...@@ -516,10 +594,11 @@ SELECT n.nspname, r.rolname FROM pg_namespace n
------------+------------------ ------------+------------------
newschema1 | regress_testrol2 newschema1 | regress_testrol2
newschema2 | current_user newschema2 | current_user
newschema3 | regress_testrol1 newschema3 | regress_testrol2
newschema4 | regress_testrolx newschema4 | regress_testrol1
newschema5 | Public newschema5 | regress_testrolx
(5 rows) newschema6 | Public
(6 rows)
-- ALTER TABLE OWNER TO -- ALTER TABLE OWNER TO
\c - \c -
...@@ -530,27 +609,25 @@ CREATE TABLE testtab3 (a int); ...@@ -530,27 +609,25 @@ CREATE TABLE testtab3 (a int);
CREATE TABLE testtab4 (a int); CREATE TABLE testtab4 (a int);
CREATE TABLE testtab5 (a int); CREATE TABLE testtab5 (a int);
CREATE TABLE testtab6 (a int); CREATE TABLE testtab6 (a int);
CREATE TABLE testtab7 (a int);
\c - \c -
SET SESSION AUTHORIZATION regress_testrol1; SET SESSION AUTHORIZATION regress_testrol1;
SET ROLE regress_testrol2; SET ROLE regress_testrol2;
ALTER TABLE testtab1 OWNER TO CURRENT_USER; ALTER TABLE testtab1 OWNER TO CURRENT_USER;
ALTER TABLE testtab2 OWNER TO "current_user"; ALTER TABLE testtab2 OWNER TO "current_user";
ALTER TABLE testtab3 OWNER TO SESSION_USER; ALTER TABLE testtab3 OWNER TO CURRENT_ROLE;
ALTER TABLE testtab4 OWNER TO regress_testrolx; ALTER TABLE testtab4 OWNER TO SESSION_USER;
ALTER TABLE testtab5 OWNER TO "Public"; ALTER TABLE testtab5 OWNER TO regress_testrolx;
ALTER TABLE testtab6 OWNER TO CURRENT_ROLE; -- error ALTER TABLE testtab6 OWNER TO "Public";
ERROR: syntax error at or near "CURRENT_ROLE" ALTER TABLE testtab7 OWNER TO USER; --error
LINE 1: ALTER TABLE testtab6 OWNER TO CURRENT_ROLE;
^
ALTER TABLE testtab6 OWNER TO USER; --error
ERROR: syntax error at or near "USER" ERROR: syntax error at or near "USER"
LINE 1: ALTER TABLE testtab6 OWNER TO USER; LINE 1: ALTER TABLE testtab7 OWNER TO USER;
^ ^
ALTER TABLE testtab6 OWNER TO PUBLIC; -- error ALTER TABLE testtab7 OWNER TO PUBLIC; -- error
ERROR: role "public" does not exist ERROR: role "public" does not exist
ALTER TABLE testtab6 OWNER TO "public"; -- error ALTER TABLE testtab7 OWNER TO "public"; -- error
ERROR: role "public" does not exist ERROR: role "public" does not exist
ALTER TABLE testtab6 OWNER TO nonexistent; -- error ALTER TABLE testtab7 OWNER TO nonexistent; -- error
ERROR: role "nonexistent" does not exist ERROR: role "nonexistent" does not exist
SELECT c.relname, r.rolname SELECT c.relname, r.rolname
FROM pg_class c JOIN pg_roles r ON (r.oid = c.relowner) FROM pg_class c JOIN pg_roles r ON (r.oid = c.relowner)
...@@ -560,11 +637,12 @@ SELECT c.relname, r.rolname ...@@ -560,11 +637,12 @@ SELECT c.relname, r.rolname
----------+------------------ ----------+------------------
testtab1 | regress_testrol2 testtab1 | regress_testrol2
testtab2 | current_user testtab2 | current_user
testtab3 | regress_testrol1 testtab3 | regress_testrol2
testtab4 | regress_testrolx testtab4 | regress_testrol1
testtab5 | Public testtab5 | regress_testrolx
testtab6 | regress_testrol0 testtab6 | Public
(6 rows) testtab7 | regress_testrol0
(7 rows)
-- ALTER TABLE, VIEW, MATERIALIZED VIEW, FOREIGN TABLE, SEQUENCE are -- ALTER TABLE, VIEW, MATERIALIZED VIEW, FOREIGN TABLE, SEQUENCE are
-- changed their owner in the same way. -- changed their owner in the same way.
...@@ -580,27 +658,25 @@ CREATE AGGREGATE testagg6(int2) (SFUNC = int2_sum, STYPE = int8); ...@@ -580,27 +658,25 @@ CREATE AGGREGATE testagg6(int2) (SFUNC = int2_sum, STYPE = int8);
CREATE AGGREGATE testagg7(int2) (SFUNC = int2_sum, STYPE = int8); CREATE AGGREGATE testagg7(int2) (SFUNC = int2_sum, STYPE = int8);
CREATE AGGREGATE testagg8(int2) (SFUNC = int2_sum, STYPE = int8); CREATE AGGREGATE testagg8(int2) (SFUNC = int2_sum, STYPE = int8);
CREATE AGGREGATE testagg9(int2) (SFUNC = int2_sum, STYPE = int8); CREATE AGGREGATE testagg9(int2) (SFUNC = int2_sum, STYPE = int8);
CREATE AGGREGATE testagga(int2) (SFUNC = int2_sum, STYPE = int8);
\c - \c -
SET SESSION AUTHORIZATION regress_testrol1; SET SESSION AUTHORIZATION regress_testrol1;
SET ROLE regress_testrol2; SET ROLE regress_testrol2;
ALTER AGGREGATE testagg1(int2) OWNER TO CURRENT_USER; ALTER AGGREGATE testagg1(int2) OWNER TO CURRENT_USER;
ALTER AGGREGATE testagg2(int2) OWNER TO "current_user"; ALTER AGGREGATE testagg2(int2) OWNER TO "current_user";
ALTER AGGREGATE testagg3(int2) OWNER TO SESSION_USER; ALTER AGGREGATE testagg3(int2) OWNER TO CURRENT_ROLE;
ALTER AGGREGATE testagg4(int2) OWNER TO regress_testrolx; ALTER AGGREGATE testagg4(int2) OWNER TO SESSION_USER;
ALTER AGGREGATE testagg5(int2) OWNER TO "Public"; ALTER AGGREGATE testagg5(int2) OWNER TO regress_testrolx;
ALTER AGGREGATE testagg5(int2) OWNER TO CURRENT_ROLE; -- error ALTER AGGREGATE testagg6(int2) OWNER TO "Public";
ERROR: syntax error at or near "CURRENT_ROLE" ALTER AGGREGATE testagg6(int2) OWNER TO USER; -- error
LINE 1: ALTER AGGREGATE testagg5(int2) OWNER TO CURRENT_ROLE;
^
ALTER AGGREGATE testagg5(int2) OWNER TO USER; -- error
ERROR: syntax error at or near "USER" ERROR: syntax error at or near "USER"
LINE 1: ALTER AGGREGATE testagg5(int2) OWNER TO USER; LINE 1: ALTER AGGREGATE testagg6(int2) OWNER TO USER;
^ ^
ALTER AGGREGATE testagg5(int2) OWNER TO PUBLIC; -- error ALTER AGGREGATE testagg6(int2) OWNER TO PUBLIC; -- error
ERROR: role "public" does not exist ERROR: role "public" does not exist
ALTER AGGREGATE testagg5(int2) OWNER TO "public"; -- error ALTER AGGREGATE testagg6(int2) OWNER TO "public"; -- error
ERROR: role "public" does not exist ERROR: role "public" does not exist
ALTER AGGREGATE testagg5(int2) OWNER TO nonexistent; -- error ALTER AGGREGATE testagg6(int2) OWNER TO nonexistent; -- error
ERROR: role "nonexistent" does not exist ERROR: role "nonexistent" does not exist
SELECT p.proname, r.rolname SELECT p.proname, r.rolname
FROM pg_proc p JOIN pg_roles r ON (r.oid = p.proowner) FROM pg_proc p JOIN pg_roles r ON (r.oid = p.proowner)
...@@ -610,14 +686,15 @@ SELECT p.proname, r.rolname ...@@ -610,14 +686,15 @@ SELECT p.proname, r.rolname
----------+------------------ ----------+------------------
testagg1 | regress_testrol2 testagg1 | regress_testrol2
testagg2 | current_user testagg2 | current_user
testagg3 | regress_testrol1 testagg3 | regress_testrol2
testagg4 | regress_testrolx testagg4 | regress_testrol1
testagg5 | Public testagg5 | regress_testrolx
testagg6 | regress_testrol0 testagg6 | Public
testagg7 | regress_testrol0 testagg7 | regress_testrol0
testagg8 | regress_testrol0 testagg8 | regress_testrol0
testagg9 | regress_testrol0 testagg9 | regress_testrol0
(9 rows) testagga | regress_testrol0
(10 rows)
-- CREATE USER MAPPING -- CREATE USER MAPPING
CREATE FOREIGN DATA WRAPPER test_wrapper; CREATE FOREIGN DATA WRAPPER test_wrapper;
...@@ -630,58 +707,52 @@ CREATE SERVER sv6 FOREIGN DATA WRAPPER test_wrapper; ...@@ -630,58 +707,52 @@ CREATE SERVER sv6 FOREIGN DATA WRAPPER test_wrapper;
CREATE SERVER sv7 FOREIGN DATA WRAPPER test_wrapper; CREATE SERVER sv7 FOREIGN DATA WRAPPER test_wrapper;
CREATE SERVER sv8 FOREIGN DATA WRAPPER test_wrapper; CREATE SERVER sv8 FOREIGN DATA WRAPPER test_wrapper;
CREATE SERVER sv9 FOREIGN DATA WRAPPER test_wrapper; CREATE SERVER sv9 FOREIGN DATA WRAPPER test_wrapper;
CREATE SERVER sv10 FOREIGN DATA WRAPPER test_wrapper;
CREATE USER MAPPING FOR CURRENT_USER SERVER sv1 OPTIONS (user 'CURRENT_USER'); CREATE USER MAPPING FOR CURRENT_USER SERVER sv1 OPTIONS (user 'CURRENT_USER');
CREATE USER MAPPING FOR "current_user" SERVER sv2 OPTIONS (user '"current_user"'); CREATE USER MAPPING FOR "current_user" SERVER sv2 OPTIONS (user '"current_user"');
CREATE USER MAPPING FOR USER SERVER sv3 OPTIONS (user 'USER'); CREATE USER MAPPING FOR CURRENT_ROLE SERVER sv3 OPTIONS (user 'CURRENT_ROLE');
CREATE USER MAPPING FOR "user" SERVER sv4 OPTIONS (user '"USER"'); CREATE USER MAPPING FOR USER SERVER sv4 OPTIONS (user 'USER');
CREATE USER MAPPING FOR SESSION_USER SERVER sv5 OPTIONS (user 'SESSION_USER'); CREATE USER MAPPING FOR "user" SERVER sv5 OPTIONS (user '"USER"');
CREATE USER MAPPING FOR PUBLIC SERVER sv6 OPTIONS (user 'PUBLIC'); CREATE USER MAPPING FOR SESSION_USER SERVER sv6 OPTIONS (user 'SESSION_USER');
CREATE USER MAPPING FOR "Public" SERVER sv7 OPTIONS (user '"Public"'); CREATE USER MAPPING FOR PUBLIC SERVER sv7 OPTIONS (user 'PUBLIC');
CREATE USER MAPPING FOR regress_testrolx SERVER sv8 OPTIONS (user 'regress_testrolx'); CREATE USER MAPPING FOR "Public" SERVER sv8 OPTIONS (user '"Public"');
CREATE USER MAPPING FOR CURRENT_ROLE SERVER sv9 CREATE USER MAPPING FOR regress_testrolx SERVER sv9 OPTIONS (user 'regress_testrolx');
OPTIONS (user 'CURRENT_ROLE'); -- error CREATE USER MAPPING FOR nonexistent SERVER sv10 OPTIONS (user 'nonexistent'); -- error;
ERROR: syntax error at or near "CURRENT_ROLE"
LINE 1: CREATE USER MAPPING FOR CURRENT_ROLE SERVER sv9
^
CREATE USER MAPPING FOR nonexistent SERVER sv9
OPTIONS (user 'nonexistent'); -- error;
ERROR: role "nonexistent" does not exist ERROR: role "nonexistent" does not exist
SELECT * FROM chkumapping(); SELECT * FROM chkumapping();
umname | umserver | umoptions umname | umserver | umoptions
------------------+----------+--------------------------- ------------------+----------+---------------------------
regress_testrol2 | sv1 | {user=CURRENT_USER} regress_testrol2 | sv1 | {user=CURRENT_USER}
current_user | sv2 | {"user=\"current_user\""} current_user | sv2 | {"user=\"current_user\""}
regress_testrol2 | sv3 | {user=USER} regress_testrol2 | sv3 | {user=CURRENT_ROLE}
user | sv4 | {"user=\"USER\""} regress_testrol2 | sv4 | {user=USER}
regress_testrol1 | sv5 | {user=SESSION_USER} user | sv5 | {"user=\"USER\""}
| sv6 | {user=PUBLIC} regress_testrol1 | sv6 | {user=SESSION_USER}
Public | sv7 | {"user=\"Public\""} | sv7 | {user=PUBLIC}
regress_testrolx | sv8 | {user=regress_testrolx} Public | sv8 | {"user=\"Public\""}
(8 rows) regress_testrolx | sv9 | {user=regress_testrolx}
(9 rows)
-- ALTER USER MAPPING -- ALTER USER MAPPING
ALTER USER MAPPING FOR CURRENT_USER SERVER sv1 ALTER USER MAPPING FOR CURRENT_USER SERVER sv1
OPTIONS (SET user 'CURRENT_USER_alt'); OPTIONS (SET user 'CURRENT_USER_alt');
ALTER USER MAPPING FOR "current_user" SERVER sv2 ALTER USER MAPPING FOR "current_user" SERVER sv2
OPTIONS (SET user '"current_user"_alt'); OPTIONS (SET user '"current_user"_alt');
ALTER USER MAPPING FOR USER SERVER sv3 ALTER USER MAPPING FOR CURRENT_ROLE SERVER sv3
OPTIONS (SET user 'CURRENT_ROLE_alt');
ALTER USER MAPPING FOR USER SERVER sv4
OPTIONS (SET user 'USER_alt'); OPTIONS (SET user 'USER_alt');
ALTER USER MAPPING FOR "user" SERVER sv4 ALTER USER MAPPING FOR "user" SERVER sv5
OPTIONS (SET user '"user"_alt'); OPTIONS (SET user '"user"_alt');
ALTER USER MAPPING FOR SESSION_USER SERVER sv5 ALTER USER MAPPING FOR SESSION_USER SERVER sv6
OPTIONS (SET user 'SESSION_USER_alt'); OPTIONS (SET user 'SESSION_USER_alt');
ALTER USER MAPPING FOR PUBLIC SERVER sv6 ALTER USER MAPPING FOR PUBLIC SERVER sv7
OPTIONS (SET user 'public_alt'); OPTIONS (SET user 'public_alt');
ALTER USER MAPPING FOR "Public" SERVER sv7 ALTER USER MAPPING FOR "Public" SERVER sv8
OPTIONS (SET user '"Public"_alt'); OPTIONS (SET user '"Public"_alt');
ALTER USER MAPPING FOR regress_testrolx SERVER sv8 ALTER USER MAPPING FOR regress_testrolx SERVER sv9
OPTIONS (SET user 'regress_testrolx_alt'); OPTIONS (SET user 'regress_testrolx_alt');
ALTER USER MAPPING FOR CURRENT_ROLE SERVER sv9 ALTER USER MAPPING FOR nonexistent SERVER sv10
OPTIONS (SET user 'CURRENT_ROLE_alt');
ERROR: syntax error at or near "CURRENT_ROLE"
LINE 1: ALTER USER MAPPING FOR CURRENT_ROLE SERVER sv9
^
ALTER USER MAPPING FOR nonexistent SERVER sv9
OPTIONS (SET user 'nonexistent_alt'); -- error OPTIONS (SET user 'nonexistent_alt'); -- error
ERROR: role "nonexistent" does not exist ERROR: role "nonexistent" does not exist
SELECT * FROM chkumapping(); SELECT * FROM chkumapping();
...@@ -689,28 +760,26 @@ SELECT * FROM chkumapping(); ...@@ -689,28 +760,26 @@ SELECT * FROM chkumapping();
------------------+----------+------------------------------- ------------------+----------+-------------------------------
regress_testrol2 | sv1 | {user=CURRENT_USER_alt} regress_testrol2 | sv1 | {user=CURRENT_USER_alt}
current_user | sv2 | {"user=\"current_user\"_alt"} current_user | sv2 | {"user=\"current_user\"_alt"}
regress_testrol2 | sv3 | {user=USER_alt} regress_testrol2 | sv3 | {user=CURRENT_ROLE_alt}
user | sv4 | {"user=\"user\"_alt"} regress_testrol2 | sv4 | {user=USER_alt}
regress_testrol1 | sv5 | {user=SESSION_USER_alt} user | sv5 | {"user=\"user\"_alt"}
| sv6 | {user=public_alt} regress_testrol1 | sv6 | {user=SESSION_USER_alt}
Public | sv7 | {"user=\"Public\"_alt"} | sv7 | {user=public_alt}
regress_testrolx | sv8 | {user=regress_testrolx_alt} Public | sv8 | {"user=\"Public\"_alt"}
(8 rows) regress_testrolx | sv9 | {user=regress_testrolx_alt}
(9 rows)
-- DROP USER MAPPING -- DROP USER MAPPING
DROP USER MAPPING FOR CURRENT_USER SERVER sv1; DROP USER MAPPING FOR CURRENT_USER SERVER sv1;
DROP USER MAPPING FOR "current_user" SERVER sv2; DROP USER MAPPING FOR "current_user" SERVER sv2;
DROP USER MAPPING FOR USER SERVER sv3; DROP USER MAPPING FOR CURRENT_ROLE SERVER sv3;
DROP USER MAPPING FOR "user" SERVER sv4; DROP USER MAPPING FOR USER SERVER sv4;
DROP USER MAPPING FOR SESSION_USER SERVER sv5; DROP USER MAPPING FOR "user" SERVER sv5;
DROP USER MAPPING FOR PUBLIC SERVER sv6; DROP USER MAPPING FOR SESSION_USER SERVER sv6;
DROP USER MAPPING FOR "Public" SERVER sv7; DROP USER MAPPING FOR PUBLIC SERVER sv7;
DROP USER MAPPING FOR regress_testrolx SERVER sv8; DROP USER MAPPING FOR "Public" SERVER sv8;
DROP USER MAPPING FOR CURRENT_ROLE SERVER sv9; -- error DROP USER MAPPING FOR regress_testrolx SERVER sv9;
ERROR: syntax error at or near "CURRENT_ROLE" DROP USER MAPPING FOR nonexistent SERVER sv10; -- error
LINE 1: DROP USER MAPPING FOR CURRENT_ROLE SERVER sv9;
^
DROP USER MAPPING FOR nonexistent SERVER sv; -- error
ERROR: role "nonexistent" does not exist ERROR: role "nonexistent" does not exist
SELECT * FROM chkumapping(); SELECT * FROM chkumapping();
umname | umserver | umoptions umname | umserver | umoptions
...@@ -719,24 +788,26 @@ SELECT * FROM chkumapping(); ...@@ -719,24 +788,26 @@ SELECT * FROM chkumapping();
CREATE USER MAPPING FOR CURRENT_USER SERVER sv1 OPTIONS (user 'CURRENT_USER'); CREATE USER MAPPING FOR CURRENT_USER SERVER sv1 OPTIONS (user 'CURRENT_USER');
CREATE USER MAPPING FOR "current_user" SERVER sv2 OPTIONS (user '"current_user"'); CREATE USER MAPPING FOR "current_user" SERVER sv2 OPTIONS (user '"current_user"');
CREATE USER MAPPING FOR USER SERVER sv3 OPTIONS (user 'USER'); CREATE USER MAPPING FOR CURRENT_ROLE SERVER sv3 OPTIONS (user 'CURRENT_ROLE');
CREATE USER MAPPING FOR "user" SERVER sv4 OPTIONS (user '"USER"'); CREATE USER MAPPING FOR USER SERVER sv4 OPTIONS (user 'USER');
CREATE USER MAPPING FOR SESSION_USER SERVER sv5 OPTIONS (user 'SESSION_USER'); CREATE USER MAPPING FOR "user" SERVER sv5 OPTIONS (user '"USER"');
CREATE USER MAPPING FOR PUBLIC SERVER sv6 OPTIONS (user 'PUBLIC'); CREATE USER MAPPING FOR SESSION_USER SERVER sv6 OPTIONS (user 'SESSION_USER');
CREATE USER MAPPING FOR "Public" SERVER sv7 OPTIONS (user '"Public"'); CREATE USER MAPPING FOR PUBLIC SERVER sv7 OPTIONS (user 'PUBLIC');
CREATE USER MAPPING FOR regress_testrolx SERVER sv8 OPTIONS (user 'regress_testrolx'); CREATE USER MAPPING FOR "Public" SERVER sv8 OPTIONS (user '"Public"');
CREATE USER MAPPING FOR regress_testrolx SERVER sv9 OPTIONS (user 'regress_testrolx');
SELECT * FROM chkumapping(); SELECT * FROM chkumapping();
umname | umserver | umoptions umname | umserver | umoptions
------------------+----------+--------------------------- ------------------+----------+---------------------------
regress_testrol2 | sv1 | {user=CURRENT_USER} regress_testrol2 | sv1 | {user=CURRENT_USER}
current_user | sv2 | {"user=\"current_user\""} current_user | sv2 | {"user=\"current_user\""}
regress_testrol2 | sv3 | {user=USER} regress_testrol2 | sv3 | {user=CURRENT_ROLE}
user | sv4 | {"user=\"USER\""} regress_testrol2 | sv4 | {user=USER}
regress_testrol1 | sv5 | {user=SESSION_USER} user | sv5 | {"user=\"USER\""}
| sv6 | {user=PUBLIC} regress_testrol1 | sv6 | {user=SESSION_USER}
Public | sv7 | {"user=\"Public\""} | sv7 | {user=PUBLIC}
regress_testrolx | sv8 | {user=regress_testrolx} Public | sv8 | {"user=\"Public\""}
(8 rows) regress_testrolx | sv9 | {user=regress_testrolx}
(9 rows)
-- DROP USER MAPPING IF EXISTS -- DROP USER MAPPING IF EXISTS
DROP USER MAPPING IF EXISTS FOR CURRENT_USER SERVER sv1; DROP USER MAPPING IF EXISTS FOR CURRENT_USER SERVER sv1;
...@@ -744,82 +815,92 @@ SELECT * FROM chkumapping(); ...@@ -744,82 +815,92 @@ SELECT * FROM chkumapping();
umname | umserver | umoptions umname | umserver | umoptions
------------------+----------+--------------------------- ------------------+----------+---------------------------
current_user | sv2 | {"user=\"current_user\""} current_user | sv2 | {"user=\"current_user\""}
regress_testrol2 | sv3 | {user=USER} regress_testrol2 | sv3 | {user=CURRENT_ROLE}
user | sv4 | {"user=\"USER\""} regress_testrol2 | sv4 | {user=USER}
regress_testrol1 | sv5 | {user=SESSION_USER} user | sv5 | {"user=\"USER\""}
| sv6 | {user=PUBLIC} regress_testrol1 | sv6 | {user=SESSION_USER}
Public | sv7 | {"user=\"Public\""} | sv7 | {user=PUBLIC}
regress_testrolx | sv8 | {user=regress_testrolx} Public | sv8 | {"user=\"Public\""}
(7 rows) regress_testrolx | sv9 | {user=regress_testrolx}
(8 rows)
DROP USER MAPPING IF EXISTS FOR "current_user" SERVER sv2; DROP USER MAPPING IF EXISTS FOR "current_user" SERVER sv2;
SELECT * FROM chkumapping(); SELECT * FROM chkumapping();
umname | umserver | umoptions umname | umserver | umoptions
------------------+----------+------------------------- ------------------+----------+-------------------------
regress_testrol2 | sv3 | {user=USER} regress_testrol2 | sv3 | {user=CURRENT_ROLE}
user | sv4 | {"user=\"USER\""} regress_testrol2 | sv4 | {user=USER}
regress_testrol1 | sv5 | {user=SESSION_USER} user | sv5 | {"user=\"USER\""}
| sv6 | {user=PUBLIC} regress_testrol1 | sv6 | {user=SESSION_USER}
Public | sv7 | {"user=\"Public\""} | sv7 | {user=PUBLIC}
regress_testrolx | sv8 | {user=regress_testrolx} Public | sv8 | {"user=\"Public\""}
regress_testrolx | sv9 | {user=regress_testrolx}
(7 rows)
DROP USER MAPPING IF EXISTS FOR CURRENT_USER SERVER sv3;
SELECT * FROM chkumapping();
umname | umserver | umoptions
------------------+----------+-------------------------
regress_testrol2 | sv4 | {user=USER}
user | sv5 | {"user=\"USER\""}
regress_testrol1 | sv6 | {user=SESSION_USER}
| sv7 | {user=PUBLIC}
Public | sv8 | {"user=\"Public\""}
regress_testrolx | sv9 | {user=regress_testrolx}
(6 rows) (6 rows)
DROP USER MAPPING IF EXISTS FOR USER SERVER sv3; DROP USER MAPPING IF EXISTS FOR USER SERVER sv4;
SELECT * FROM chkumapping(); SELECT * FROM chkumapping();
umname | umserver | umoptions umname | umserver | umoptions
------------------+----------+------------------------- ------------------+----------+-------------------------
user | sv4 | {"user=\"USER\""} user | sv5 | {"user=\"USER\""}
regress_testrol1 | sv5 | {user=SESSION_USER} regress_testrol1 | sv6 | {user=SESSION_USER}
| sv6 | {user=PUBLIC} | sv7 | {user=PUBLIC}
Public | sv7 | {"user=\"Public\""} Public | sv8 | {"user=\"Public\""}
regress_testrolx | sv8 | {user=regress_testrolx} regress_testrolx | sv9 | {user=regress_testrolx}
(5 rows) (5 rows)
DROP USER MAPPING IF EXISTS FOR "user" SERVER sv4; DROP USER MAPPING IF EXISTS FOR "user" SERVER sv5;
SELECT * FROM chkumapping(); SELECT * FROM chkumapping();
umname | umserver | umoptions umname | umserver | umoptions
------------------+----------+------------------------- ------------------+----------+-------------------------
regress_testrol1 | sv5 | {user=SESSION_USER} regress_testrol1 | sv6 | {user=SESSION_USER}
| sv6 | {user=PUBLIC} | sv7 | {user=PUBLIC}
Public | sv7 | {"user=\"Public\""} Public | sv8 | {"user=\"Public\""}
regress_testrolx | sv8 | {user=regress_testrolx} regress_testrolx | sv9 | {user=regress_testrolx}
(4 rows) (4 rows)
DROP USER MAPPING IF EXISTS FOR SESSION_USER SERVER sv5; DROP USER MAPPING IF EXISTS FOR SESSION_USER SERVER sv6;
SELECT * FROM chkumapping(); SELECT * FROM chkumapping();
umname | umserver | umoptions umname | umserver | umoptions
------------------+----------+------------------------- ------------------+----------+-------------------------
| sv6 | {user=PUBLIC} | sv7 | {user=PUBLIC}
Public | sv7 | {"user=\"Public\""} Public | sv8 | {"user=\"Public\""}
regress_testrolx | sv8 | {user=regress_testrolx} regress_testrolx | sv9 | {user=regress_testrolx}
(3 rows) (3 rows)
DROP USER MAPPING IF EXISTS FOR PUBLIC SERVER sv6; DROP USER MAPPING IF EXISTS FOR PUBLIC SERVER sv7;
SELECT * FROM chkumapping(); SELECT * FROM chkumapping();
umname | umserver | umoptions umname | umserver | umoptions
------------------+----------+------------------------- ------------------+----------+-------------------------
Public | sv7 | {"user=\"Public\""} Public | sv8 | {"user=\"Public\""}
regress_testrolx | sv8 | {user=regress_testrolx} regress_testrolx | sv9 | {user=regress_testrolx}
(2 rows) (2 rows)
DROP USER MAPPING IF EXISTS FOR "Public" SERVER sv7; DROP USER MAPPING IF EXISTS FOR "Public" SERVER sv8;
SELECT * FROM chkumapping(); SELECT * FROM chkumapping();
umname | umserver | umoptions umname | umserver | umoptions
------------------+----------+------------------------- ------------------+----------+-------------------------
regress_testrolx | sv8 | {user=regress_testrolx} regress_testrolx | sv9 | {user=regress_testrolx}
(1 row) (1 row)
DROP USER MAPPING IF EXISTS FOR regress_testrolx SERVER sv8; DROP USER MAPPING IF EXISTS FOR regress_testrolx SERVER sv9;
SELECT * FROM chkumapping(); SELECT * FROM chkumapping();
umname | umserver | umoptions umname | umserver | umoptions
--------+----------+----------- --------+----------+-----------
(0 rows) (0 rows)
DROP USER MAPPING IF EXISTS FOR CURRENT_ROLE SERVER sv9; --error DROP USER MAPPING IF EXISTS FOR nonexistent SERVER sv10; -- error
ERROR: syntax error at or near "CURRENT_ROLE"
LINE 1: DROP USER MAPPING IF EXISTS FOR CURRENT_ROLE SERVER sv9;
^
DROP USER MAPPING IF EXISTS FOR nonexistent SERVER sv9; -- error
NOTICE: role "nonexistent" does not exist, skipping NOTICE: role "nonexistent" does not exist, skipping
-- GRANT/REVOKE -- GRANT/REVOKE
GRANT regress_testrol0 TO pg_signal_backend; -- success GRANT regress_testrol0 TO pg_signal_backend; -- success
...@@ -840,7 +921,8 @@ SELECT proname, proacl FROM pg_proc WHERE proname LIKE 'testagg_'; ...@@ -840,7 +921,8 @@ SELECT proname, proacl FROM pg_proc WHERE proname LIKE 'testagg_';
testagg7 | testagg7 |
testagg8 | testagg8 |
testagg9 | testagg9 |
(9 rows) testagga |
(10 rows)
REVOKE ALL PRIVILEGES ON FUNCTION testagg1(int2) FROM PUBLIC; REVOKE ALL PRIVILEGES ON FUNCTION testagg1(int2) FROM PUBLIC;
REVOKE ALL PRIVILEGES ON FUNCTION testagg2(int2) FROM PUBLIC; REVOKE ALL PRIVILEGES ON FUNCTION testagg2(int2) FROM PUBLIC;
...@@ -853,108 +935,106 @@ REVOKE ALL PRIVILEGES ON FUNCTION testagg8(int2) FROM PUBLIC; ...@@ -853,108 +935,106 @@ REVOKE ALL PRIVILEGES ON FUNCTION testagg8(int2) FROM PUBLIC;
GRANT ALL PRIVILEGES ON FUNCTION testagg1(int2) TO PUBLIC; GRANT ALL PRIVILEGES ON FUNCTION testagg1(int2) TO PUBLIC;
GRANT ALL PRIVILEGES ON FUNCTION testagg2(int2) TO CURRENT_USER; GRANT ALL PRIVILEGES ON FUNCTION testagg2(int2) TO CURRENT_USER;
GRANT ALL PRIVILEGES ON FUNCTION testagg3(int2) TO "current_user"; GRANT ALL PRIVILEGES ON FUNCTION testagg3(int2) TO "current_user";
GRANT ALL PRIVILEGES ON FUNCTION testagg4(int2) TO SESSION_USER; GRANT ALL PRIVILEGES ON FUNCTION testagg4(int2) TO CURRENT_ROLE;
GRANT ALL PRIVILEGES ON FUNCTION testagg5(int2) TO "Public"; GRANT ALL PRIVILEGES ON FUNCTION testagg5(int2) TO SESSION_USER;
GRANT ALL PRIVILEGES ON FUNCTION testagg6(int2) TO regress_testrolx; GRANT ALL PRIVILEGES ON FUNCTION testagg6(int2) TO "Public";
GRANT ALL PRIVILEGES ON FUNCTION testagg7(int2) TO "public"; GRANT ALL PRIVILEGES ON FUNCTION testagg7(int2) TO regress_testrolx;
GRANT ALL PRIVILEGES ON FUNCTION testagg8(int2) GRANT ALL PRIVILEGES ON FUNCTION testagg8(int2) TO "public";
GRANT ALL PRIVILEGES ON FUNCTION testagg9(int2)
TO current_user, public, regress_testrolx; TO current_user, public, regress_testrolx;
SELECT proname, proacl FROM pg_proc WHERE proname LIKE 'testagg_'; SELECT proname, proacl FROM pg_proc WHERE proname LIKE 'testagg_';
proname | proacl proname | proacl
----------+----------------------------------------------------------------------------------------------------------------------------------- ----------+-----------------------------------------------------------------------------------------------------------------------------------
testagg1 | {regress_testrol2=X/regress_testrol2,=X/regress_testrol2} testagg1 | {regress_testrol2=X/regress_testrol2,=X/regress_testrol2}
testagg2 | {current_user=X/current_user,regress_testrol2=X/current_user} testagg2 | {current_user=X/current_user,regress_testrol2=X/current_user}
testagg3 | {regress_testrol1=X/regress_testrol1,current_user=X/regress_testrol1} testagg3 | {regress_testrol2=X/regress_testrol2,current_user=X/regress_testrol2}
testagg4 | {regress_testrolx=X/regress_testrolx,regress_testrol1=X/regress_testrolx} testagg4 | {regress_testrol1=X/regress_testrol1,regress_testrol2=X/regress_testrol1}
testagg5 | {Public=X/Public} testagg5 | {regress_testrolx=X/regress_testrolx,regress_testrol1=X/regress_testrolx}
testagg6 | {regress_testrol0=X/regress_testrol0,regress_testrolx=X/regress_testrol0} testagg6 | {Public=X/Public}
testagg7 | {regress_testrol0=X/regress_testrol0,=X/regress_testrol0} testagg7 | {regress_testrol0=X/regress_testrol0,regress_testrolx=X/regress_testrol0}
testagg8 | {regress_testrol0=X/regress_testrol0,regress_testrol2=X/regress_testrol0,=X/regress_testrol0,regress_testrolx=X/regress_testrol0} testagg8 | {regress_testrol0=X/regress_testrol0,=X/regress_testrol0}
testagg9 | testagg9 | {=X/regress_testrol0,regress_testrol0=X/regress_testrol0,regress_testrol2=X/regress_testrol0,regress_testrolx=X/regress_testrol0}
(9 rows) testagga |
(10 rows)
GRANT ALL PRIVILEGES ON FUNCTION testagg9(int2) TO CURRENT_ROLE; --error GRANT ALL PRIVILEGES ON FUNCTION testagga(int2) TO USER; --error
ERROR: syntax error at or near "CURRENT_ROLE"
LINE 1: ...RANT ALL PRIVILEGES ON FUNCTION testagg9(int2) TO CURRENT_RO...
^
GRANT ALL PRIVILEGES ON FUNCTION testagg9(int2) TO USER; --error
ERROR: syntax error at or near "USER" ERROR: syntax error at or near "USER"
LINE 1: GRANT ALL PRIVILEGES ON FUNCTION testagg9(int2) TO USER; LINE 1: GRANT ALL PRIVILEGES ON FUNCTION testagga(int2) TO USER;
^ ^
GRANT ALL PRIVILEGES ON FUNCTION testagg9(int2) TO NONE; --error GRANT ALL PRIVILEGES ON FUNCTION testagga(int2) TO NONE; --error
ERROR: role name "none" is reserved ERROR: role name "none" is reserved
LINE 1: GRANT ALL PRIVILEGES ON FUNCTION testagg9(int2) TO NONE; LINE 1: GRANT ALL PRIVILEGES ON FUNCTION testagga(int2) TO NONE;
^ ^
GRANT ALL PRIVILEGES ON FUNCTION testagg9(int2) TO "none"; --error GRANT ALL PRIVILEGES ON FUNCTION testagga(int2) TO "none"; --error
ERROR: role name "none" is reserved ERROR: role name "none" is reserved
LINE 1: GRANT ALL PRIVILEGES ON FUNCTION testagg9(int2) TO "none"; LINE 1: GRANT ALL PRIVILEGES ON FUNCTION testagga(int2) TO "none";
^ ^
SELECT proname, proacl FROM pg_proc WHERE proname LIKE 'testagg_'; SELECT proname, proacl FROM pg_proc WHERE proname LIKE 'testagg_';
proname | proacl proname | proacl
----------+----------------------------------------------------------------------------------------------------------------------------------- ----------+-----------------------------------------------------------------------------------------------------------------------------------
testagg1 | {regress_testrol2=X/regress_testrol2,=X/regress_testrol2} testagg1 | {regress_testrol2=X/regress_testrol2,=X/regress_testrol2}
testagg2 | {current_user=X/current_user,regress_testrol2=X/current_user} testagg2 | {current_user=X/current_user,regress_testrol2=X/current_user}
testagg3 | {regress_testrol1=X/regress_testrol1,current_user=X/regress_testrol1} testagg3 | {regress_testrol2=X/regress_testrol2,current_user=X/regress_testrol2}
testagg4 | {regress_testrolx=X/regress_testrolx,regress_testrol1=X/regress_testrolx} testagg4 | {regress_testrol1=X/regress_testrol1,regress_testrol2=X/regress_testrol1}
testagg5 | {Public=X/Public} testagg5 | {regress_testrolx=X/regress_testrolx,regress_testrol1=X/regress_testrolx}
testagg6 | {regress_testrol0=X/regress_testrol0,regress_testrolx=X/regress_testrol0} testagg6 | {Public=X/Public}
testagg7 | {regress_testrol0=X/regress_testrol0,=X/regress_testrol0} testagg7 | {regress_testrol0=X/regress_testrol0,regress_testrolx=X/regress_testrol0}
testagg8 | {regress_testrol0=X/regress_testrol0,regress_testrol2=X/regress_testrol0,=X/regress_testrol0,regress_testrolx=X/regress_testrol0} testagg8 | {regress_testrol0=X/regress_testrol0,=X/regress_testrol0}
testagg9 | testagg9 | {=X/regress_testrol0,regress_testrol0=X/regress_testrol0,regress_testrol2=X/regress_testrol0,regress_testrolx=X/regress_testrol0}
(9 rows) testagga |
(10 rows)
REVOKE ALL PRIVILEGES ON FUNCTION testagg1(int2) FROM PUBLIC; REVOKE ALL PRIVILEGES ON FUNCTION testagg1(int2) FROM PUBLIC;
REVOKE ALL PRIVILEGES ON FUNCTION testagg2(int2) FROM CURRENT_USER; REVOKE ALL PRIVILEGES ON FUNCTION testagg2(int2) FROM CURRENT_USER;
REVOKE ALL PRIVILEGES ON FUNCTION testagg3(int2) FROM "current_user"; REVOKE ALL PRIVILEGES ON FUNCTION testagg3(int2) FROM "current_user";
REVOKE ALL PRIVILEGES ON FUNCTION testagg4(int2) FROM SESSION_USER; REVOKE ALL PRIVILEGES ON FUNCTION testagg4(int2) FROM CURRENT_ROLE;
REVOKE ALL PRIVILEGES ON FUNCTION testagg5(int2) FROM "Public"; REVOKE ALL PRIVILEGES ON FUNCTION testagg5(int2) FROM SESSION_USER;
REVOKE ALL PRIVILEGES ON FUNCTION testagg6(int2) FROM regress_testrolx; REVOKE ALL PRIVILEGES ON FUNCTION testagg6(int2) FROM "Public";
REVOKE ALL PRIVILEGES ON FUNCTION testagg7(int2) FROM "public"; REVOKE ALL PRIVILEGES ON FUNCTION testagg7(int2) FROM regress_testrolx;
REVOKE ALL PRIVILEGES ON FUNCTION testagg8(int2) REVOKE ALL PRIVILEGES ON FUNCTION testagg8(int2) FROM "public";
REVOKE ALL PRIVILEGES ON FUNCTION testagg9(int2)
FROM current_user, public, regress_testrolx; FROM current_user, public, regress_testrolx;
SELECT proname, proacl FROM pg_proc WHERE proname LIKE 'testagg_'; SELECT proname, proacl FROM pg_proc WHERE proname LIKE 'testagg_';
proname | proacl proname | proacl
----------+--------------------------------------- ----------+---------------------------------------
testagg1 | {regress_testrol2=X/regress_testrol2} testagg1 | {regress_testrol2=X/regress_testrol2}
testagg2 | {current_user=X/current_user} testagg2 | {current_user=X/current_user}
testagg3 | {regress_testrol1=X/regress_testrol1} testagg3 | {regress_testrol2=X/regress_testrol2}
testagg4 | {regress_testrolx=X/regress_testrolx} testagg4 | {regress_testrol1=X/regress_testrol1}
testagg5 | {} testagg5 | {regress_testrolx=X/regress_testrolx}
testagg6 | {regress_testrol0=X/regress_testrol0} testagg6 | {}
testagg7 | {regress_testrol0=X/regress_testrol0} testagg7 | {regress_testrol0=X/regress_testrol0}
testagg8 | {regress_testrol0=X/regress_testrol0} testagg8 | {regress_testrol0=X/regress_testrol0}
testagg9 | testagg9 | {regress_testrol0=X/regress_testrol0}
(9 rows) testagga |
(10 rows)
REVOKE ALL PRIVILEGES ON FUNCTION testagg9(int2) FROM CURRENT_ROLE; --error REVOKE ALL PRIVILEGES ON FUNCTION testagga(int2) FROM USER; --error
ERROR: syntax error at or near "CURRENT_ROLE"
LINE 1: ...KE ALL PRIVILEGES ON FUNCTION testagg9(int2) FROM CURRENT_RO...
^
REVOKE ALL PRIVILEGES ON FUNCTION testagg9(int2) FROM USER; --error
ERROR: syntax error at or near "USER" ERROR: syntax error at or near "USER"
LINE 1: REVOKE ALL PRIVILEGES ON FUNCTION testagg9(int2) FROM USER; LINE 1: REVOKE ALL PRIVILEGES ON FUNCTION testagga(int2) FROM USER;
^ ^
REVOKE ALL PRIVILEGES ON FUNCTION testagg9(int2) FROM NONE; --error REVOKE ALL PRIVILEGES ON FUNCTION testagga(int2) FROM NONE; --error
ERROR: role name "none" is reserved ERROR: role name "none" is reserved
LINE 1: REVOKE ALL PRIVILEGES ON FUNCTION testagg9(int2) FROM NONE; LINE 1: REVOKE ALL PRIVILEGES ON FUNCTION testagga(int2) FROM NONE;
^ ^
REVOKE ALL PRIVILEGES ON FUNCTION testagg9(int2) FROM "none"; --error REVOKE ALL PRIVILEGES ON FUNCTION testagga(int2) FROM "none"; --error
ERROR: role name "none" is reserved ERROR: role name "none" is reserved
LINE 1: ...EVOKE ALL PRIVILEGES ON FUNCTION testagg9(int2) FROM "none"; LINE 1: ...EVOKE ALL PRIVILEGES ON FUNCTION testagga(int2) FROM "none";
^ ^
SELECT proname, proacl FROM pg_proc WHERE proname LIKE 'testagg_'; SELECT proname, proacl FROM pg_proc WHERE proname LIKE 'testagg_';
proname | proacl proname | proacl
----------+--------------------------------------- ----------+---------------------------------------
testagg1 | {regress_testrol2=X/regress_testrol2} testagg1 | {regress_testrol2=X/regress_testrol2}
testagg2 | {current_user=X/current_user} testagg2 | {current_user=X/current_user}
testagg3 | {regress_testrol1=X/regress_testrol1} testagg3 | {regress_testrol2=X/regress_testrol2}
testagg4 | {regress_testrolx=X/regress_testrolx} testagg4 | {regress_testrol1=X/regress_testrol1}
testagg5 | {} testagg5 | {regress_testrolx=X/regress_testrolx}
testagg6 | {regress_testrol0=X/regress_testrol0} testagg6 | {}
testagg7 | {regress_testrol0=X/regress_testrol0} testagg7 | {regress_testrol0=X/regress_testrol0}
testagg8 | {regress_testrol0=X/regress_testrol0} testagg8 | {regress_testrol0=X/regress_testrol0}
testagg9 | testagg9 | {regress_testrol0=X/regress_testrol0}
(9 rows) testagga |
(10 rows)
-- DEFAULT MONITORING ROLES -- DEFAULT MONITORING ROLES
CREATE ROLE regress_role_haspriv; CREATE ROLE regress_role_haspriv;
...@@ -1005,7 +1085,7 @@ REVOKE pg_read_all_settings FROM regress_role_haspriv; ...@@ -1005,7 +1085,7 @@ REVOKE pg_read_all_settings FROM regress_role_haspriv;
-- clean up -- clean up
\c \c
DROP SCHEMA test_roles_schema; DROP SCHEMA test_roles_schema;
DROP OWNED BY regress_testrol0, "Public", "current_user", regress_testrol1, regress_testrol2, regress_testrolx CASCADE; DROP OWNED BY regress_testrol0, "Public", "current_role", "current_user", regress_testrol1, regress_testrol2, regress_testrolx CASCADE;
DROP ROLE regress_testrol0, regress_testrol1, regress_testrol2, regress_testrolx; DROP ROLE regress_testrol0, regress_testrol1, regress_testrol2, regress_testrolx;
DROP ROLE "Public", "None", "current_user", "session_user", "user"; DROP ROLE "Public", "None", "current_role", "current_user", "session_user", "user";
DROP ROLE regress_role_haspriv, regress_role_nopriv; DROP ROLE regress_role_haspriv, regress_role_nopriv;
...@@ -3,8 +3,10 @@ CREATE OR REPLACE FUNCTION chkrolattr() ...@@ -3,8 +3,10 @@ CREATE OR REPLACE FUNCTION chkrolattr()
AS $$ AS $$
SELECT r.rolname, v.keyword, r.rolcanlogin, r.rolreplication SELECT r.rolname, v.keyword, r.rolcanlogin, r.rolreplication
FROM pg_roles r FROM pg_roles r
JOIN (VALUES(CURRENT_USER, 'current_user'), JOIN (VALUES(CURRENT_ROLE, 'current_role'),
(CURRENT_USER, 'current_user'),
(SESSION_USER, 'session_user'), (SESSION_USER, 'session_user'),
('current_role', '-'),
('current_user', '-'), ('current_user', '-'),
('session_user', '-'), ('session_user', '-'),
('Public', '-'), ('Public', '-'),
...@@ -22,7 +24,8 @@ SELECT COALESCE(d.datname, 'ALL'), COALESCE(r.rolname, 'ALL'), ...@@ -22,7 +24,8 @@ SELECT COALESCE(d.datname, 'ALL'), COALESCE(r.rolname, 'ALL'),
FROM pg_db_role_setting s FROM pg_db_role_setting s
LEFT JOIN pg_roles r ON (r.oid = s.setrole) LEFT JOIN pg_roles r ON (r.oid = s.setrole)
LEFT JOIN pg_database d ON (d.oid = s.setdatabase) LEFT JOIN pg_database d ON (d.oid = s.setdatabase)
LEFT JOIN (VALUES(CURRENT_USER, 'current_user'), LEFT JOIN (VALUES(CURRENT_ROLE, 'current_role'),
(CURRENT_USER, 'current_user'),
(SESSION_USER, 'session_user')) (SESSION_USER, 'session_user'))
AS v(uname, keyword) AS v(uname, keyword)
ON (r.rolname = v.uname) ON (r.rolname = v.uname)
...@@ -50,6 +53,7 @@ SET client_min_messages = ERROR; ...@@ -50,6 +53,7 @@ SET client_min_messages = ERROR;
CREATE ROLE "Public"; CREATE ROLE "Public";
CREATE ROLE "None"; CREATE ROLE "None";
CREATE ROLE "current_role";
CREATE ROLE "current_user"; CREATE ROLE "current_user";
CREATE ROLE "session_user"; CREATE ROLE "session_user";
CREATE ROLE "user"; CREATE ROLE "user";
...@@ -84,6 +88,11 @@ SET ROLE regress_testrol2; ...@@ -84,6 +88,11 @@ SET ROLE regress_testrol2;
-- ALTER ROLE -- ALTER ROLE
BEGIN; BEGIN;
SELECT * FROM chkrolattr(); SELECT * FROM chkrolattr();
ALTER ROLE CURRENT_ROLE WITH REPLICATION;
SELECT * FROM chkrolattr();
ALTER ROLE "current_role" WITH REPLICATION;
SELECT * FROM chkrolattr();
ALTER ROLE CURRENT_ROLE WITH NOREPLICATION;
ALTER ROLE CURRENT_USER WITH REPLICATION; ALTER ROLE CURRENT_USER WITH REPLICATION;
SELECT * FROM chkrolattr(); SELECT * FROM chkrolattr();
ALTER ROLE "current_user" WITH REPLICATION; ALTER ROLE "current_user" WITH REPLICATION;
...@@ -101,7 +110,6 @@ SELECT * FROM chkrolattr(); ...@@ -101,7 +110,6 @@ SELECT * FROM chkrolattr();
ROLLBACK; ROLLBACK;
ALTER ROLE USER WITH LOGIN; -- error ALTER ROLE USER WITH LOGIN; -- error
ALTER ROLE CURRENT_ROLE WITH LOGIN; --error
ALTER ROLE ALL WITH REPLICATION; -- error ALTER ROLE ALL WITH REPLICATION; -- error
ALTER ROLE SESSION_ROLE WITH NOREPLICATION; -- error ALTER ROLE SESSION_ROLE WITH NOREPLICATION; -- error
ALTER ROLE PUBLIC WITH NOREPLICATION; -- error ALTER ROLE PUBLIC WITH NOREPLICATION; -- error
...@@ -113,6 +121,11 @@ ALTER ROLE nonexistent WITH NOREPLICATION; -- error ...@@ -113,6 +121,11 @@ ALTER ROLE nonexistent WITH NOREPLICATION; -- error
-- ALTER USER -- ALTER USER
BEGIN; BEGIN;
SELECT * FROM chkrolattr(); SELECT * FROM chkrolattr();
ALTER USER CURRENT_ROLE WITH REPLICATION;
SELECT * FROM chkrolattr();
ALTER USER "current_role" WITH REPLICATION;
SELECT * FROM chkrolattr();
ALTER USER CURRENT_ROLE WITH NOREPLICATION;
ALTER USER CURRENT_USER WITH REPLICATION; ALTER USER CURRENT_USER WITH REPLICATION;
SELECT * FROM chkrolattr(); SELECT * FROM chkrolattr();
ALTER USER "current_user" WITH REPLICATION; ALTER USER "current_user" WITH REPLICATION;
...@@ -130,7 +143,6 @@ SELECT * FROM chkrolattr(); ...@@ -130,7 +143,6 @@ SELECT * FROM chkrolattr();
ROLLBACK; ROLLBACK;
ALTER USER USER WITH LOGIN; -- error ALTER USER USER WITH LOGIN; -- error
ALTER USER CURRENT_ROLE WITH LOGIN; -- error
ALTER USER ALL WITH REPLICATION; -- error ALTER USER ALL WITH REPLICATION; -- error
ALTER USER SESSION_ROLE WITH NOREPLICATION; -- error ALTER USER SESSION_ROLE WITH NOREPLICATION; -- error
ALTER USER PUBLIC WITH NOREPLICATION; -- error ALTER USER PUBLIC WITH NOREPLICATION; -- error
...@@ -141,6 +153,7 @@ ALTER USER nonexistent WITH NOREPLICATION; -- error ...@@ -141,6 +153,7 @@ ALTER USER nonexistent WITH NOREPLICATION; -- error
-- ALTER ROLE SET/RESET -- ALTER ROLE SET/RESET
SELECT * FROM chksetconfig(); SELECT * FROM chksetconfig();
ALTER ROLE CURRENT_ROLE SET application_name to 'BAZ';
ALTER ROLE CURRENT_USER SET application_name to 'FOO'; ALTER ROLE CURRENT_USER SET application_name to 'FOO';
ALTER ROLE SESSION_USER SET application_name to 'BAR'; ALTER ROLE SESSION_USER SET application_name to 'BAR';
ALTER ROLE "current_user" SET application_name to 'FOOFOO'; ALTER ROLE "current_user" SET application_name to 'FOOFOO';
...@@ -149,6 +162,7 @@ ALTER ROLE ALL SET application_name to 'SLAP'; ...@@ -149,6 +162,7 @@ ALTER ROLE ALL SET application_name to 'SLAP';
SELECT * FROM chksetconfig(); SELECT * FROM chksetconfig();
ALTER ROLE regress_testrol1 SET application_name to 'SLAM'; ALTER ROLE regress_testrol1 SET application_name to 'SLAM';
SELECT * FROM chksetconfig(); SELECT * FROM chksetconfig();
ALTER ROLE CURRENT_ROLE RESET application_name;
ALTER ROLE CURRENT_USER RESET application_name; ALTER ROLE CURRENT_USER RESET application_name;
ALTER ROLE SESSION_USER RESET application_name; ALTER ROLE SESSION_USER RESET application_name;
ALTER ROLE "current_user" RESET application_name; ALTER ROLE "current_user" RESET application_name;
...@@ -157,13 +171,13 @@ ALTER ROLE ALL RESET application_name; ...@@ -157,13 +171,13 @@ ALTER ROLE ALL RESET application_name;
SELECT * FROM chksetconfig(); SELECT * FROM chksetconfig();
ALTER ROLE CURRENT_ROLE SET application_name to 'BAZ'; -- error
ALTER ROLE USER SET application_name to 'BOOM'; -- error ALTER ROLE USER SET application_name to 'BOOM'; -- error
ALTER ROLE PUBLIC SET application_name to 'BOMB'; -- error ALTER ROLE PUBLIC SET application_name to 'BOMB'; -- error
ALTER ROLE nonexistent SET application_name to 'BOMB'; -- error ALTER ROLE nonexistent SET application_name to 'BOMB'; -- error
-- ALTER USER SET/RESET -- ALTER USER SET/RESET
SELECT * FROM chksetconfig(); SELECT * FROM chksetconfig();
ALTER USER CURRENT_ROLE SET application_name to 'BAZ';
ALTER USER CURRENT_USER SET application_name to 'FOO'; ALTER USER CURRENT_USER SET application_name to 'FOO';
ALTER USER SESSION_USER SET application_name to 'BAR'; ALTER USER SESSION_USER SET application_name to 'BAR';
ALTER USER "current_user" SET application_name to 'FOOFOO'; ALTER USER "current_user" SET application_name to 'FOOFOO';
...@@ -172,6 +186,7 @@ ALTER USER ALL SET application_name to 'SLAP'; ...@@ -172,6 +186,7 @@ ALTER USER ALL SET application_name to 'SLAP';
SELECT * FROM chksetconfig(); SELECT * FROM chksetconfig();
ALTER USER regress_testrol1 SET application_name to 'SLAM'; ALTER USER regress_testrol1 SET application_name to 'SLAM';
SELECT * FROM chksetconfig(); SELECT * FROM chksetconfig();
ALTER USER CURRENT_ROLE RESET application_name;
ALTER USER CURRENT_USER RESET application_name; ALTER USER CURRENT_USER RESET application_name;
ALTER USER SESSION_USER RESET application_name; ALTER USER SESSION_USER RESET application_name;
ALTER USER "current_user" RESET application_name; ALTER USER "current_user" RESET application_name;
...@@ -180,7 +195,6 @@ ALTER USER ALL RESET application_name; ...@@ -180,7 +195,6 @@ ALTER USER ALL RESET application_name;
SELECT * FROM chksetconfig(); SELECT * FROM chksetconfig();
ALTER USER CURRENT_ROLE SET application_name to 'BAZ'; -- error
ALTER USER USER SET application_name to 'BOOM'; -- error ALTER USER USER SET application_name to 'BOOM'; -- error
ALTER USER PUBLIC SET application_name to 'BOMB'; -- error ALTER USER PUBLIC SET application_name to 'BOMB'; -- error
ALTER USER NONE SET application_name to 'BOMB'; -- error ALTER USER NONE SET application_name to 'BOMB'; -- error
...@@ -189,16 +203,16 @@ ALTER USER nonexistent SET application_name to 'BOMB'; -- error ...@@ -189,16 +203,16 @@ ALTER USER nonexistent SET application_name to 'BOMB'; -- error
-- CREATE SCHEMA -- CREATE SCHEMA
CREATE SCHEMA newschema1 AUTHORIZATION CURRENT_USER; CREATE SCHEMA newschema1 AUTHORIZATION CURRENT_USER;
CREATE SCHEMA newschema2 AUTHORIZATION "current_user"; CREATE SCHEMA newschema2 AUTHORIZATION "current_user";
CREATE SCHEMA newschema3 AUTHORIZATION SESSION_USER; CREATE SCHEMA newschema3 AUTHORIZATION CURRENT_ROLE;
CREATE SCHEMA newschema4 AUTHORIZATION regress_testrolx; CREATE SCHEMA newschema4 AUTHORIZATION SESSION_USER;
CREATE SCHEMA newschema5 AUTHORIZATION "Public"; CREATE SCHEMA newschema5 AUTHORIZATION regress_testrolx;
CREATE SCHEMA newschema6 AUTHORIZATION "Public";
CREATE SCHEMA newschema6 AUTHORIZATION USER; -- error CREATE SCHEMA newschemax AUTHORIZATION USER; -- error
CREATE SCHEMA newschema6 AUTHORIZATION CURRENT_ROLE; -- error CREATE SCHEMA newschemax AUTHORIZATION PUBLIC; -- error
CREATE SCHEMA newschema6 AUTHORIZATION PUBLIC; -- error CREATE SCHEMA newschemax AUTHORIZATION "public"; -- error
CREATE SCHEMA newschema6 AUTHORIZATION "public"; -- error CREATE SCHEMA newschemax AUTHORIZATION NONE; -- error
CREATE SCHEMA newschema6 AUTHORIZATION NONE; -- error CREATE SCHEMA newschemax AUTHORIZATION nonexistent; -- error
CREATE SCHEMA newschema6 AUTHORIZATION nonexistent; -- error
SELECT n.nspname, r.rolname FROM pg_namespace n SELECT n.nspname, r.rolname FROM pg_namespace n
JOIN pg_roles r ON (r.oid = n.nspowner) JOIN pg_roles r ON (r.oid = n.nspowner)
...@@ -206,16 +220,16 @@ SELECT n.nspname, r.rolname FROM pg_namespace n ...@@ -206,16 +220,16 @@ SELECT n.nspname, r.rolname FROM pg_namespace n
CREATE SCHEMA IF NOT EXISTS newschema1 AUTHORIZATION CURRENT_USER; CREATE SCHEMA IF NOT EXISTS newschema1 AUTHORIZATION CURRENT_USER;
CREATE SCHEMA IF NOT EXISTS newschema2 AUTHORIZATION "current_user"; CREATE SCHEMA IF NOT EXISTS newschema2 AUTHORIZATION "current_user";
CREATE SCHEMA IF NOT EXISTS newschema3 AUTHORIZATION SESSION_USER; CREATE SCHEMA IF NOT EXISTS newschema3 AUTHORIZATION CURRENT_ROLE;
CREATE SCHEMA IF NOT EXISTS newschema4 AUTHORIZATION regress_testrolx; CREATE SCHEMA IF NOT EXISTS newschema4 AUTHORIZATION SESSION_USER;
CREATE SCHEMA IF NOT EXISTS newschema5 AUTHORIZATION "Public"; CREATE SCHEMA IF NOT EXISTS newschema5 AUTHORIZATION regress_testrolx;
CREATE SCHEMA IF NOT EXISTS newschema6 AUTHORIZATION "Public";
CREATE SCHEMA IF NOT EXISTS newschema6 AUTHORIZATION USER; -- error CREATE SCHEMA IF NOT EXISTS newschemax AUTHORIZATION USER; -- error
CREATE SCHEMA IF NOT EXISTS newschema6 AUTHORIZATION CURRENT_ROLE; -- error CREATE SCHEMA IF NOT EXISTS newschemax AUTHORIZATION PUBLIC; -- error
CREATE SCHEMA IF NOT EXISTS newschema6 AUTHORIZATION PUBLIC; -- error CREATE SCHEMA IF NOT EXISTS newschemax AUTHORIZATION "public"; -- error
CREATE SCHEMA IF NOT EXISTS newschema6 AUTHORIZATION "public"; -- error CREATE SCHEMA IF NOT EXISTS newschemax AUTHORIZATION NONE; -- error
CREATE SCHEMA IF NOT EXISTS newschema6 AUTHORIZATION NONE; -- error CREATE SCHEMA IF NOT EXISTS newschemax AUTHORIZATION nonexistent; -- error
CREATE SCHEMA IF NOT EXISTS newschema6 AUTHORIZATION nonexistent; -- error
SELECT n.nspname, r.rolname FROM pg_namespace n SELECT n.nspname, r.rolname FROM pg_namespace n
JOIN pg_roles r ON (r.oid = n.nspowner) JOIN pg_roles r ON (r.oid = n.nspowner)
...@@ -230,6 +244,7 @@ CREATE TABLE testtab3 (a int); ...@@ -230,6 +244,7 @@ CREATE TABLE testtab3 (a int);
CREATE TABLE testtab4 (a int); CREATE TABLE testtab4 (a int);
CREATE TABLE testtab5 (a int); CREATE TABLE testtab5 (a int);
CREATE TABLE testtab6 (a int); CREATE TABLE testtab6 (a int);
CREATE TABLE testtab7 (a int);
\c - \c -
SET SESSION AUTHORIZATION regress_testrol1; SET SESSION AUTHORIZATION regress_testrol1;
...@@ -237,15 +252,15 @@ SET ROLE regress_testrol2; ...@@ -237,15 +252,15 @@ SET ROLE regress_testrol2;
ALTER TABLE testtab1 OWNER TO CURRENT_USER; ALTER TABLE testtab1 OWNER TO CURRENT_USER;
ALTER TABLE testtab2 OWNER TO "current_user"; ALTER TABLE testtab2 OWNER TO "current_user";
ALTER TABLE testtab3 OWNER TO SESSION_USER; ALTER TABLE testtab3 OWNER TO CURRENT_ROLE;
ALTER TABLE testtab4 OWNER TO regress_testrolx; ALTER TABLE testtab4 OWNER TO SESSION_USER;
ALTER TABLE testtab5 OWNER TO "Public"; ALTER TABLE testtab5 OWNER TO regress_testrolx;
ALTER TABLE testtab6 OWNER TO "Public";
ALTER TABLE testtab6 OWNER TO CURRENT_ROLE; -- error ALTER TABLE testtab7 OWNER TO USER; --error
ALTER TABLE testtab6 OWNER TO USER; --error ALTER TABLE testtab7 OWNER TO PUBLIC; -- error
ALTER TABLE testtab6 OWNER TO PUBLIC; -- error ALTER TABLE testtab7 OWNER TO "public"; -- error
ALTER TABLE testtab6 OWNER TO "public"; -- error ALTER TABLE testtab7 OWNER TO nonexistent; -- error
ALTER TABLE testtab6 OWNER TO nonexistent; -- error
SELECT c.relname, r.rolname SELECT c.relname, r.rolname
FROM pg_class c JOIN pg_roles r ON (r.oid = c.relowner) FROM pg_class c JOIN pg_roles r ON (r.oid = c.relowner)
...@@ -267,6 +282,7 @@ CREATE AGGREGATE testagg6(int2) (SFUNC = int2_sum, STYPE = int8); ...@@ -267,6 +282,7 @@ CREATE AGGREGATE testagg6(int2) (SFUNC = int2_sum, STYPE = int8);
CREATE AGGREGATE testagg7(int2) (SFUNC = int2_sum, STYPE = int8); CREATE AGGREGATE testagg7(int2) (SFUNC = int2_sum, STYPE = int8);
CREATE AGGREGATE testagg8(int2) (SFUNC = int2_sum, STYPE = int8); CREATE AGGREGATE testagg8(int2) (SFUNC = int2_sum, STYPE = int8);
CREATE AGGREGATE testagg9(int2) (SFUNC = int2_sum, STYPE = int8); CREATE AGGREGATE testagg9(int2) (SFUNC = int2_sum, STYPE = int8);
CREATE AGGREGATE testagga(int2) (SFUNC = int2_sum, STYPE = int8);
\c - \c -
SET SESSION AUTHORIZATION regress_testrol1; SET SESSION AUTHORIZATION regress_testrol1;
...@@ -274,15 +290,15 @@ SET ROLE regress_testrol2; ...@@ -274,15 +290,15 @@ SET ROLE regress_testrol2;
ALTER AGGREGATE testagg1(int2) OWNER TO CURRENT_USER; ALTER AGGREGATE testagg1(int2) OWNER TO CURRENT_USER;
ALTER AGGREGATE testagg2(int2) OWNER TO "current_user"; ALTER AGGREGATE testagg2(int2) OWNER TO "current_user";
ALTER AGGREGATE testagg3(int2) OWNER TO SESSION_USER; ALTER AGGREGATE testagg3(int2) OWNER TO CURRENT_ROLE;
ALTER AGGREGATE testagg4(int2) OWNER TO regress_testrolx; ALTER AGGREGATE testagg4(int2) OWNER TO SESSION_USER;
ALTER AGGREGATE testagg5(int2) OWNER TO "Public"; ALTER AGGREGATE testagg5(int2) OWNER TO regress_testrolx;
ALTER AGGREGATE testagg6(int2) OWNER TO "Public";
ALTER AGGREGATE testagg5(int2) OWNER TO CURRENT_ROLE; -- error ALTER AGGREGATE testagg6(int2) OWNER TO USER; -- error
ALTER AGGREGATE testagg5(int2) OWNER TO USER; -- error ALTER AGGREGATE testagg6(int2) OWNER TO PUBLIC; -- error
ALTER AGGREGATE testagg5(int2) OWNER TO PUBLIC; -- error ALTER AGGREGATE testagg6(int2) OWNER TO "public"; -- error
ALTER AGGREGATE testagg5(int2) OWNER TO "public"; -- error ALTER AGGREGATE testagg6(int2) OWNER TO nonexistent; -- error
ALTER AGGREGATE testagg5(int2) OWNER TO nonexistent; -- error
SELECT p.proname, r.rolname SELECT p.proname, r.rolname
FROM pg_proc p JOIN pg_roles r ON (r.oid = p.proowner) FROM pg_proc p JOIN pg_roles r ON (r.oid = p.proowner)
...@@ -300,20 +316,19 @@ CREATE SERVER sv6 FOREIGN DATA WRAPPER test_wrapper; ...@@ -300,20 +316,19 @@ CREATE SERVER sv6 FOREIGN DATA WRAPPER test_wrapper;
CREATE SERVER sv7 FOREIGN DATA WRAPPER test_wrapper; CREATE SERVER sv7 FOREIGN DATA WRAPPER test_wrapper;
CREATE SERVER sv8 FOREIGN DATA WRAPPER test_wrapper; CREATE SERVER sv8 FOREIGN DATA WRAPPER test_wrapper;
CREATE SERVER sv9 FOREIGN DATA WRAPPER test_wrapper; CREATE SERVER sv9 FOREIGN DATA WRAPPER test_wrapper;
CREATE SERVER sv10 FOREIGN DATA WRAPPER test_wrapper;
CREATE USER MAPPING FOR CURRENT_USER SERVER sv1 OPTIONS (user 'CURRENT_USER'); CREATE USER MAPPING FOR CURRENT_USER SERVER sv1 OPTIONS (user 'CURRENT_USER');
CREATE USER MAPPING FOR "current_user" SERVER sv2 OPTIONS (user '"current_user"'); CREATE USER MAPPING FOR "current_user" SERVER sv2 OPTIONS (user '"current_user"');
CREATE USER MAPPING FOR USER SERVER sv3 OPTIONS (user 'USER'); CREATE USER MAPPING FOR CURRENT_ROLE SERVER sv3 OPTIONS (user 'CURRENT_ROLE');
CREATE USER MAPPING FOR "user" SERVER sv4 OPTIONS (user '"USER"'); CREATE USER MAPPING FOR USER SERVER sv4 OPTIONS (user 'USER');
CREATE USER MAPPING FOR SESSION_USER SERVER sv5 OPTIONS (user 'SESSION_USER'); CREATE USER MAPPING FOR "user" SERVER sv5 OPTIONS (user '"USER"');
CREATE USER MAPPING FOR PUBLIC SERVER sv6 OPTIONS (user 'PUBLIC'); CREATE USER MAPPING FOR SESSION_USER SERVER sv6 OPTIONS (user 'SESSION_USER');
CREATE USER MAPPING FOR "Public" SERVER sv7 OPTIONS (user '"Public"'); CREATE USER MAPPING FOR PUBLIC SERVER sv7 OPTIONS (user 'PUBLIC');
CREATE USER MAPPING FOR regress_testrolx SERVER sv8 OPTIONS (user 'regress_testrolx'); CREATE USER MAPPING FOR "Public" SERVER sv8 OPTIONS (user '"Public"');
CREATE USER MAPPING FOR regress_testrolx SERVER sv9 OPTIONS (user 'regress_testrolx');
CREATE USER MAPPING FOR CURRENT_ROLE SERVER sv9
OPTIONS (user 'CURRENT_ROLE'); -- error CREATE USER MAPPING FOR nonexistent SERVER sv10 OPTIONS (user 'nonexistent'); -- error;
CREATE USER MAPPING FOR nonexistent SERVER sv9
OPTIONS (user 'nonexistent'); -- error;
SELECT * FROM chkumapping(); SELECT * FROM chkumapping();
...@@ -322,22 +337,22 @@ ALTER USER MAPPING FOR CURRENT_USER SERVER sv1 ...@@ -322,22 +337,22 @@ ALTER USER MAPPING FOR CURRENT_USER SERVER sv1
OPTIONS (SET user 'CURRENT_USER_alt'); OPTIONS (SET user 'CURRENT_USER_alt');
ALTER USER MAPPING FOR "current_user" SERVER sv2 ALTER USER MAPPING FOR "current_user" SERVER sv2
OPTIONS (SET user '"current_user"_alt'); OPTIONS (SET user '"current_user"_alt');
ALTER USER MAPPING FOR USER SERVER sv3 ALTER USER MAPPING FOR CURRENT_ROLE SERVER sv3
OPTIONS (SET user 'CURRENT_ROLE_alt');
ALTER USER MAPPING FOR USER SERVER sv4
OPTIONS (SET user 'USER_alt'); OPTIONS (SET user 'USER_alt');
ALTER USER MAPPING FOR "user" SERVER sv4 ALTER USER MAPPING FOR "user" SERVER sv5
OPTIONS (SET user '"user"_alt'); OPTIONS (SET user '"user"_alt');
ALTER USER MAPPING FOR SESSION_USER SERVER sv5 ALTER USER MAPPING FOR SESSION_USER SERVER sv6
OPTIONS (SET user 'SESSION_USER_alt'); OPTIONS (SET user 'SESSION_USER_alt');
ALTER USER MAPPING FOR PUBLIC SERVER sv6 ALTER USER MAPPING FOR PUBLIC SERVER sv7
OPTIONS (SET user 'public_alt'); OPTIONS (SET user 'public_alt');
ALTER USER MAPPING FOR "Public" SERVER sv7 ALTER USER MAPPING FOR "Public" SERVER sv8
OPTIONS (SET user '"Public"_alt'); OPTIONS (SET user '"Public"_alt');
ALTER USER MAPPING FOR regress_testrolx SERVER sv8 ALTER USER MAPPING FOR regress_testrolx SERVER sv9
OPTIONS (SET user 'regress_testrolx_alt'); OPTIONS (SET user 'regress_testrolx_alt');
ALTER USER MAPPING FOR CURRENT_ROLE SERVER sv9 ALTER USER MAPPING FOR nonexistent SERVER sv10
OPTIONS (SET user 'CURRENT_ROLE_alt');
ALTER USER MAPPING FOR nonexistent SERVER sv9
OPTIONS (SET user 'nonexistent_alt'); -- error OPTIONS (SET user 'nonexistent_alt'); -- error
SELECT * FROM chkumapping(); SELECT * FROM chkumapping();
...@@ -345,25 +360,26 @@ SELECT * FROM chkumapping(); ...@@ -345,25 +360,26 @@ SELECT * FROM chkumapping();
-- DROP USER MAPPING -- DROP USER MAPPING
DROP USER MAPPING FOR CURRENT_USER SERVER sv1; DROP USER MAPPING FOR CURRENT_USER SERVER sv1;
DROP USER MAPPING FOR "current_user" SERVER sv2; DROP USER MAPPING FOR "current_user" SERVER sv2;
DROP USER MAPPING FOR USER SERVER sv3; DROP USER MAPPING FOR CURRENT_ROLE SERVER sv3;
DROP USER MAPPING FOR "user" SERVER sv4; DROP USER MAPPING FOR USER SERVER sv4;
DROP USER MAPPING FOR SESSION_USER SERVER sv5; DROP USER MAPPING FOR "user" SERVER sv5;
DROP USER MAPPING FOR PUBLIC SERVER sv6; DROP USER MAPPING FOR SESSION_USER SERVER sv6;
DROP USER MAPPING FOR "Public" SERVER sv7; DROP USER MAPPING FOR PUBLIC SERVER sv7;
DROP USER MAPPING FOR regress_testrolx SERVER sv8; DROP USER MAPPING FOR "Public" SERVER sv8;
DROP USER MAPPING FOR regress_testrolx SERVER sv9;
DROP USER MAPPING FOR CURRENT_ROLE SERVER sv9; -- error
DROP USER MAPPING FOR nonexistent SERVER sv; -- error DROP USER MAPPING FOR nonexistent SERVER sv10; -- error
SELECT * FROM chkumapping(); SELECT * FROM chkumapping();
CREATE USER MAPPING FOR CURRENT_USER SERVER sv1 OPTIONS (user 'CURRENT_USER'); CREATE USER MAPPING FOR CURRENT_USER SERVER sv1 OPTIONS (user 'CURRENT_USER');
CREATE USER MAPPING FOR "current_user" SERVER sv2 OPTIONS (user '"current_user"'); CREATE USER MAPPING FOR "current_user" SERVER sv2 OPTIONS (user '"current_user"');
CREATE USER MAPPING FOR USER SERVER sv3 OPTIONS (user 'USER'); CREATE USER MAPPING FOR CURRENT_ROLE SERVER sv3 OPTIONS (user 'CURRENT_ROLE');
CREATE USER MAPPING FOR "user" SERVER sv4 OPTIONS (user '"USER"'); CREATE USER MAPPING FOR USER SERVER sv4 OPTIONS (user 'USER');
CREATE USER MAPPING FOR SESSION_USER SERVER sv5 OPTIONS (user 'SESSION_USER'); CREATE USER MAPPING FOR "user" SERVER sv5 OPTIONS (user '"USER"');
CREATE USER MAPPING FOR PUBLIC SERVER sv6 OPTIONS (user 'PUBLIC'); CREATE USER MAPPING FOR SESSION_USER SERVER sv6 OPTIONS (user 'SESSION_USER');
CREATE USER MAPPING FOR "Public" SERVER sv7 OPTIONS (user '"Public"'); CREATE USER MAPPING FOR PUBLIC SERVER sv7 OPTIONS (user 'PUBLIC');
CREATE USER MAPPING FOR regress_testrolx SERVER sv8 OPTIONS (user 'regress_testrolx'); CREATE USER MAPPING FOR "Public" SERVER sv8 OPTIONS (user '"Public"');
CREATE USER MAPPING FOR regress_testrolx SERVER sv9 OPTIONS (user 'regress_testrolx');
SELECT * FROM chkumapping(); SELECT * FROM chkumapping();
-- DROP USER MAPPING IF EXISTS -- DROP USER MAPPING IF EXISTS
...@@ -371,21 +387,22 @@ DROP USER MAPPING IF EXISTS FOR CURRENT_USER SERVER sv1; ...@@ -371,21 +387,22 @@ DROP USER MAPPING IF EXISTS FOR CURRENT_USER SERVER sv1;
SELECT * FROM chkumapping(); SELECT * FROM chkumapping();
DROP USER MAPPING IF EXISTS FOR "current_user" SERVER sv2; DROP USER MAPPING IF EXISTS FOR "current_user" SERVER sv2;
SELECT * FROM chkumapping(); SELECT * FROM chkumapping();
DROP USER MAPPING IF EXISTS FOR USER SERVER sv3; DROP USER MAPPING IF EXISTS FOR CURRENT_USER SERVER sv3;
SELECT * FROM chkumapping();
DROP USER MAPPING IF EXISTS FOR USER SERVER sv4;
SELECT * FROM chkumapping(); SELECT * FROM chkumapping();
DROP USER MAPPING IF EXISTS FOR "user" SERVER sv4; DROP USER MAPPING IF EXISTS FOR "user" SERVER sv5;
SELECT * FROM chkumapping(); SELECT * FROM chkumapping();
DROP USER MAPPING IF EXISTS FOR SESSION_USER SERVER sv5; DROP USER MAPPING IF EXISTS FOR SESSION_USER SERVER sv6;
SELECT * FROM chkumapping(); SELECT * FROM chkumapping();
DROP USER MAPPING IF EXISTS FOR PUBLIC SERVER sv6; DROP USER MAPPING IF EXISTS FOR PUBLIC SERVER sv7;
SELECT * FROM chkumapping(); SELECT * FROM chkumapping();
DROP USER MAPPING IF EXISTS FOR "Public" SERVER sv7; DROP USER MAPPING IF EXISTS FOR "Public" SERVER sv8;
SELECT * FROM chkumapping(); SELECT * FROM chkumapping();
DROP USER MAPPING IF EXISTS FOR regress_testrolx SERVER sv8; DROP USER MAPPING IF EXISTS FOR regress_testrolx SERVER sv9;
SELECT * FROM chkumapping(); SELECT * FROM chkumapping();
DROP USER MAPPING IF EXISTS FOR CURRENT_ROLE SERVER sv9; --error DROP USER MAPPING IF EXISTS FOR nonexistent SERVER sv10; -- error
DROP USER MAPPING IF EXISTS FOR nonexistent SERVER sv9; -- error
-- GRANT/REVOKE -- GRANT/REVOKE
GRANT regress_testrol0 TO pg_signal_backend; -- success GRANT regress_testrol0 TO pg_signal_backend; -- success
...@@ -410,38 +427,38 @@ REVOKE ALL PRIVILEGES ON FUNCTION testagg8(int2) FROM PUBLIC; ...@@ -410,38 +427,38 @@ REVOKE ALL PRIVILEGES ON FUNCTION testagg8(int2) FROM PUBLIC;
GRANT ALL PRIVILEGES ON FUNCTION testagg1(int2) TO PUBLIC; GRANT ALL PRIVILEGES ON FUNCTION testagg1(int2) TO PUBLIC;
GRANT ALL PRIVILEGES ON FUNCTION testagg2(int2) TO CURRENT_USER; GRANT ALL PRIVILEGES ON FUNCTION testagg2(int2) TO CURRENT_USER;
GRANT ALL PRIVILEGES ON FUNCTION testagg3(int2) TO "current_user"; GRANT ALL PRIVILEGES ON FUNCTION testagg3(int2) TO "current_user";
GRANT ALL PRIVILEGES ON FUNCTION testagg4(int2) TO SESSION_USER; GRANT ALL PRIVILEGES ON FUNCTION testagg4(int2) TO CURRENT_ROLE;
GRANT ALL PRIVILEGES ON FUNCTION testagg5(int2) TO "Public"; GRANT ALL PRIVILEGES ON FUNCTION testagg5(int2) TO SESSION_USER;
GRANT ALL PRIVILEGES ON FUNCTION testagg6(int2) TO regress_testrolx; GRANT ALL PRIVILEGES ON FUNCTION testagg6(int2) TO "Public";
GRANT ALL PRIVILEGES ON FUNCTION testagg7(int2) TO "public"; GRANT ALL PRIVILEGES ON FUNCTION testagg7(int2) TO regress_testrolx;
GRANT ALL PRIVILEGES ON FUNCTION testagg8(int2) GRANT ALL PRIVILEGES ON FUNCTION testagg8(int2) TO "public";
GRANT ALL PRIVILEGES ON FUNCTION testagg9(int2)
TO current_user, public, regress_testrolx; TO current_user, public, regress_testrolx;
SELECT proname, proacl FROM pg_proc WHERE proname LIKE 'testagg_'; SELECT proname, proacl FROM pg_proc WHERE proname LIKE 'testagg_';
GRANT ALL PRIVILEGES ON FUNCTION testagg9(int2) TO CURRENT_ROLE; --error GRANT ALL PRIVILEGES ON FUNCTION testagga(int2) TO USER; --error
GRANT ALL PRIVILEGES ON FUNCTION testagg9(int2) TO USER; --error GRANT ALL PRIVILEGES ON FUNCTION testagga(int2) TO NONE; --error
GRANT ALL PRIVILEGES ON FUNCTION testagg9(int2) TO NONE; --error GRANT ALL PRIVILEGES ON FUNCTION testagga(int2) TO "none"; --error
GRANT ALL PRIVILEGES ON FUNCTION testagg9(int2) TO "none"; --error
SELECT proname, proacl FROM pg_proc WHERE proname LIKE 'testagg_'; SELECT proname, proacl FROM pg_proc WHERE proname LIKE 'testagg_';
REVOKE ALL PRIVILEGES ON FUNCTION testagg1(int2) FROM PUBLIC; REVOKE ALL PRIVILEGES ON FUNCTION testagg1(int2) FROM PUBLIC;
REVOKE ALL PRIVILEGES ON FUNCTION testagg2(int2) FROM CURRENT_USER; REVOKE ALL PRIVILEGES ON FUNCTION testagg2(int2) FROM CURRENT_USER;
REVOKE ALL PRIVILEGES ON FUNCTION testagg3(int2) FROM "current_user"; REVOKE ALL PRIVILEGES ON FUNCTION testagg3(int2) FROM "current_user";
REVOKE ALL PRIVILEGES ON FUNCTION testagg4(int2) FROM SESSION_USER; REVOKE ALL PRIVILEGES ON FUNCTION testagg4(int2) FROM CURRENT_ROLE;
REVOKE ALL PRIVILEGES ON FUNCTION testagg5(int2) FROM "Public"; REVOKE ALL PRIVILEGES ON FUNCTION testagg5(int2) FROM SESSION_USER;
REVOKE ALL PRIVILEGES ON FUNCTION testagg6(int2) FROM regress_testrolx; REVOKE ALL PRIVILEGES ON FUNCTION testagg6(int2) FROM "Public";
REVOKE ALL PRIVILEGES ON FUNCTION testagg7(int2) FROM "public"; REVOKE ALL PRIVILEGES ON FUNCTION testagg7(int2) FROM regress_testrolx;
REVOKE ALL PRIVILEGES ON FUNCTION testagg8(int2) REVOKE ALL PRIVILEGES ON FUNCTION testagg8(int2) FROM "public";
REVOKE ALL PRIVILEGES ON FUNCTION testagg9(int2)
FROM current_user, public, regress_testrolx; FROM current_user, public, regress_testrolx;
SELECT proname, proacl FROM pg_proc WHERE proname LIKE 'testagg_'; SELECT proname, proacl FROM pg_proc WHERE proname LIKE 'testagg_';
REVOKE ALL PRIVILEGES ON FUNCTION testagg9(int2) FROM CURRENT_ROLE; --error REVOKE ALL PRIVILEGES ON FUNCTION testagga(int2) FROM USER; --error
REVOKE ALL PRIVILEGES ON FUNCTION testagg9(int2) FROM USER; --error REVOKE ALL PRIVILEGES ON FUNCTION testagga(int2) FROM NONE; --error
REVOKE ALL PRIVILEGES ON FUNCTION testagg9(int2) FROM NONE; --error REVOKE ALL PRIVILEGES ON FUNCTION testagga(int2) FROM "none"; --error
REVOKE ALL PRIVILEGES ON FUNCTION testagg9(int2) FROM "none"; --error
SELECT proname, proacl FROM pg_proc WHERE proname LIKE 'testagg_'; SELECT proname, proacl FROM pg_proc WHERE proname LIKE 'testagg_';
...@@ -481,7 +498,7 @@ REVOKE pg_read_all_settings FROM regress_role_haspriv; ...@@ -481,7 +498,7 @@ REVOKE pg_read_all_settings FROM regress_role_haspriv;
\c \c
DROP SCHEMA test_roles_schema; DROP SCHEMA test_roles_schema;
DROP OWNED BY regress_testrol0, "Public", "current_user", regress_testrol1, regress_testrol2, regress_testrolx CASCADE; DROP OWNED BY regress_testrol0, "Public", "current_role", "current_user", regress_testrol1, regress_testrol2, regress_testrolx CASCADE;
DROP ROLE regress_testrol0, regress_testrol1, regress_testrol2, regress_testrolx; DROP ROLE regress_testrol0, regress_testrol1, regress_testrol2, regress_testrolx;
DROP ROLE "Public", "None", "current_user", "session_user", "user"; DROP ROLE "Public", "None", "current_role", "current_user", "session_user", "user";
DROP ROLE regress_role_haspriv, regress_role_nopriv; DROP ROLE regress_role_haspriv, regress_role_nopriv;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment