/* Current database is 'testdb' */
\c testdb postgres
You are now connected to database "testdb" as user "postgres".
DROP ROLE IF EXISTS testrol1;
DROP ROLE
DROP ROLE IF EXISTS testrol2;
DROP ROLE
DROP ROLE IF EXISTS testrol0;
DROP ROLE
DROP ROLE IF EXISTS testrolx;
DROP ROLE
CREATE OR REPLACE FUNCTION chkrolattr()
 RETURNS TABLE (name name, label text, canlogin bool, replication bool)
 AS $$
SELECT r.rolname, v.label, r.rolcanlogin, r.rolreplication
 FROM pg_roles r
 JOIN (VALUES(CURRENT_USER, 'current_user'),
             (SESSION_USER, 'session_user'))
      AS v(uname, label)
      ON (r.rolname = v.uname)
 ORDER BY 1;
$$ LANGUAGE SQL;
CREATE FUNCTION
CREATE OR REPLACE FUNCTION chksetconfig()
 RETURNS TABLE (name name, label text, setconfig text[])
 AS $$
SELECT r.rolname, v.label, s.setconfig
 FROM pg_roles r
 JOIN pg_db_role_setting s ON (r.oid = s.setrole)
 JOIN (VALUES(CURRENT_USER, 'current_user'),
             (SESSION_USER, 'session_user'))
      AS v(uname, label)
      ON (r.rolname = v.uname)
 WHERE s.setdatabase = 0
UNION
SELECT 'ALL', 'ALL', s.setconfig
 FROM pg_db_role_setting s
 WHERE s.setdatabase = 0 AND s.setrole = 0
ORDER BY 1;
$$ LANGUAGE SQL;
CREATE FUNCTION
CREATE ROLE testrol0 WITH SUPERUSER LOGIN;
CREATE ROLE
CREATE ROLE testrolx WITH SUPERUSER LOGIN;
CREATE ROLE
CREATE ROLE testrol2 WITH SUPERUSER;
CREATE ROLE
CREATE ROLE testrol1 WITH SUPERUSER LOGIN IN ROLE testrol2;
CREATE ROLE
\c testdb testrol1
You are now connected to database "testdb" as user "testrol1".
SET ROLE testrol2;
SET
--  ALTER ROLE
SELECT * FROM chkrolattr();
   name   |    label     | canlogin | replication 
----------+--------------+----------+-------------
 testrol1 | session_user | t        | f
 testrol2 | current_user | f        | f
(2 rows)

ALTER ROLE CURRENT_ROLE WITH REPLICATION;
ALTER ROLE
SELECT * FROM chkrolattr();
   name   |    label     | canlogin | replication 
----------+--------------+----------+-------------
 testrol1 | session_user | t        | f
 testrol2 | current_user | f        | t
(2 rows)

ALTER ROLE CURRENT_USER WITH NOREPLICATION;
ALTER ROLE
SELECT * FROM chkrolattr();
   name   |    label     | canlogin | replication 
----------+--------------+----------+-------------
 testrol1 | session_user | t        | f
 testrol2 | current_user | f        | f
(2 rows)

ALTER ROLE USER WITH REPLICATION;
ALTER ROLE
SELECT * FROM chkrolattr();
   name   |    label     | canlogin | replication 
----------+--------------+----------+-------------
 testrol1 | session_user | t        | f
 testrol2 | current_user | f        | t
(2 rows)

ALTER ROLE SESSION_USER WITH REPLICATION;
ALTER ROLE
SELECT * FROM chkrolattr();
   name   |    label     | canlogin | replication 
----------+--------------+----------+-------------
 testrol1 | session_user | t        | t
 testrol2 | current_user | f        | t
(2 rows)

ALTER ROLE testrol1 WITH NOREPLICATION;
ALTER ROLE
ALTER ROLE testrol2 WITH NOREPLICATION;
ALTER ROLE
SELECT * FROM chkrolattr();
   name   |    label     | canlogin | replication 
----------+--------------+----------+-------------
 testrol1 | session_user | t        | f
 testrol2 | current_user | f        | f
(2 rows)

ALTER ROLE ALL WITH REPLICATION; -- error
psql:test.sql:59: ERROR:  syntax error at or near "WITH REPLICATION"
LINE 1: ALTER ROLE ALL WITH REPLICATION;
                       ^
ALTER ROLE SESSION_ROLE WITH NOREPLICATION; -- error
psql:test.sql:60: ERROR:  role "session_role" does not exist
ALTER ROLE PUBLIC WITH NOREPLICATION; -- error
psql:test.sql:61: ERROR:  role "public" does not exist
ALTER ROLE nonexistent WITH NOREPLICATION; -- error
psql:test.sql:62: ERROR:  role "nonexistent" does not exist
--  ALTER USER
SELECT * FROM chkrolattr();
   name   |    label     | canlogin | replication 
----------+--------------+----------+-------------
 testrol1 | session_user | t        | f
 testrol2 | current_user | f        | f
(2 rows)

ALTER USER CURRENT_ROLE WITH REPLICATION;
ALTER ROLE
SELECT * FROM chkrolattr();
   name   |    label     | canlogin | replication 
----------+--------------+----------+-------------
 testrol1 | session_user | t        | f
 testrol2 | current_user | f        | t
(2 rows)

ALTER USER CURRENT_USER WITH NOREPLICATION;
ALTER ROLE
SELECT * FROM chkrolattr();
   name   |    label     | canlogin | replication 
----------+--------------+----------+-------------
 testrol1 | session_user | t        | f
 testrol2 | current_user | f        | f
(2 rows)

ALTER USER USER WITH REPLICATION;
ALTER ROLE
SELECT * FROM chkrolattr();
   name   |    label     | canlogin | replication 
----------+--------------+----------+-------------
 testrol1 | session_user | t        | f
 testrol2 | current_user | f        | t
(2 rows)

ALTER USER SESSION_USER WITH REPLICATION;
ALTER ROLE
SELECT * FROM chkrolattr();
   name   |    label     | canlogin | replication 
----------+--------------+----------+-------------
 testrol1 | session_user | t        | t
 testrol2 | current_user | f        | t
(2 rows)

ALTER USER testrol1 WITH NOREPLICATION;
ALTER ROLE
ALTER USER testrol2 WITH NOREPLICATION;
ALTER ROLE
SELECT * FROM chkrolattr();
   name   |    label     | canlogin | replication 
----------+--------------+----------+-------------
 testrol1 | session_user | t        | f
 testrol2 | current_user | f        | f
(2 rows)

ALTER USER ALL WITH REPLICATION; -- error
psql:test.sql:78: ERROR:  syntax error at or near "WITH REPLICATION"
LINE 1: ALTER USER ALL WITH REPLICATION;
                       ^
ALTER USER SESSION_ROLE WITH NOREPLICATION; -- error
psql:test.sql:79: ERROR:  role "session_role" does not exist
ALTER USER PUBLIC WITH NOREPLICATION; -- error
psql:test.sql:80: ERROR:  role "public" does not exist
ALTER USER nonexistent WITH NOREPLICATION; -- error
psql:test.sql:81: ERROR:  role "nonexistent" does not exist
--  ALTER ROLE SET/RESET
SELECT * FROM chksetconfig();
 name | label | setconfig 
------+-------+-----------
(0 rows)

ALTER ROLE CURRENT_USER SET application_name to 'FOO';
ALTER ROLE
ALTER ROLE SESSION_USER SET application_name to 'BAR';
ALTER ROLE
SELECT * FROM chksetconfig();
   name   |    label     |       setconfig        
----------+--------------+------------------------
 testrol1 | session_user | {application_name=BAR}
 testrol2 | current_user | {application_name=FOO}
(2 rows)

ALTER ROLE CURRENT_USER RESET application_name;
ALTER ROLE
ALTER ROLE SESSION_USER RESET application_name;
ALTER ROLE
SELECT * FROM chksetconfig();
 name | label | setconfig 
------+-------+-----------
(0 rows)

ALTER ROLE CURRENT_ROLE SET application_name to 'BAZ';
ALTER ROLE
SELECT * FROM chksetconfig();
   name   |    label     |       setconfig        
----------+--------------+------------------------
 testrol2 | current_user | {application_name=BAZ}
(1 row)

ALTER ROLE CURRENT_ROLE RESET application_name;
ALTER ROLE
SELECT * FROM chksetconfig();
 name | label | setconfig 
------+-------+-----------
(0 rows)

ALTER ROLE USER SET application_name to 'BOOM';
ALTER ROLE
SELECT * FROM chksetconfig();
   name   |    label     |        setconfig        
----------+--------------+-------------------------
 testrol2 | current_user | {application_name=BOOM}
(1 row)

ALTER ROLE USER RESET application_name;
ALTER ROLE
SELECT * FROM chksetconfig();
 name | label | setconfig 
------+-------+-----------
(0 rows)

ALTER ROLE testrol1 SET application_name to 'SLAM';
ALTER ROLE
SELECT * FROM chksetconfig();
   name   |    label     |        setconfig        
----------+--------------+-------------------------
 testrol1 | session_user | {application_name=SLAM}
(1 row)

ALTER ROLE testrol1 RESET application_name;
ALTER ROLE
SELECT * FROM chksetconfig();
 name | label | setconfig 
------+-------+-----------
(0 rows)

ALTER ROLE ALL SET application_name to 'SLAP';
ALTER ROLE
SELECT * FROM chksetconfig();
 name | label |        setconfig        
------+-------+-------------------------
 ALL  | ALL   | {application_name=SLAP}
(1 row)

ALTER ROLE ALL RESET application_name;
ALTER ROLE
SELECT * FROM chksetconfig();
 name | label | setconfig 
------+-------+-----------
(0 rows)

ALTER ROLE PUBLIC SET application_name to 'BOMB'; -- error
psql:test.sql:112: ERROR:  role "public" does not exist
ALTER ROLE nonexistent SET application_name to 'BOMB'; -- error
psql:test.sql:113: ERROR:  role "nonexistent" does not exist
ALTER ROLE PUBLIC RESET application_name; -- error
psql:test.sql:114: ERROR:  role "public" does not exist
ALTER ROLE nonexistent RESET application_name; -- error
psql:test.sql:115: ERROR:  role "nonexistent" does not exist
--  ALTER USER SET/RESET
SELECT * FROM chksetconfig();
 name | label | setconfig 
------+-------+-----------
(0 rows)

ALTER USER CURRENT_USER SET application_name to 'FOO';
ALTER ROLE
ALTER USER SESSION_USER SET application_name to 'BAR';
ALTER ROLE
SELECT * FROM chksetconfig();
   name   |    label     |       setconfig        
----------+--------------+------------------------
 testrol1 | session_user | {application_name=BAR}
 testrol2 | current_user | {application_name=FOO}
(2 rows)

ALTER USER CURRENT_USER RESET application_name;
ALTER ROLE
ALTER USER SESSION_USER RESET application_name;
ALTER ROLE
SELECT * FROM chksetconfig();
 name | label | setconfig 
------+-------+-----------
(0 rows)

ALTER USER CURRENT_ROLE SET application_name to 'BAZ';
ALTER ROLE
SELECT * FROM chksetconfig();
   name   |    label     |       setconfig        
----------+--------------+------------------------
 testrol2 | current_user | {application_name=BAZ}
(1 row)

ALTER USER CURRENT_ROLE RESET application_name;
ALTER ROLE
SELECT * FROM chksetconfig();
 name | label | setconfig 
------+-------+-----------
(0 rows)

ALTER USER USER SET application_name to 'BOOM';
ALTER ROLE
SELECT * FROM chksetconfig();
   name   |    label     |        setconfig        
----------+--------------+-------------------------
 testrol2 | current_user | {application_name=BOOM}
(1 row)

ALTER USER USER RESET application_name;
ALTER ROLE
SELECT * FROM chksetconfig();
 name | label | setconfig 
------+-------+-----------
(0 rows)

ALTER USER testrol1 SET application_name to 'SLAM';
ALTER ROLE
SELECT * FROM chksetconfig();
   name   |    label     |        setconfig        
----------+--------------+-------------------------
 testrol1 | session_user | {application_name=SLAM}
(1 row)

ALTER USER testrol1 RESET application_name;
ALTER ROLE
SELECT * FROM chksetconfig();
 name | label | setconfig 
------+-------+-----------
(0 rows)

ALTER USER ALL SET application_name to 'SLAP';
ALTER ROLE
SELECT * FROM chksetconfig();
 name | label |        setconfig        
------+-------+-------------------------
 ALL  | ALL   | {application_name=SLAP}
(1 row)

ALTER USER ALL RESET application_name;
ALTER ROLE
SELECT * FROM chksetconfig();
 name | label | setconfig 
------+-------+-----------
(0 rows)

ALTER USER PUBLIC SET application_name to 'BOMB'; -- error
psql:test.sql:146: ERROR:  role "public" does not exist
ALTER USER nonexistent SET application_name to 'BOMB'; -- error
psql:test.sql:147: ERROR:  role "nonexistent" does not exist
ALTER USER PUBLIC RESET application_name; -- error
psql:test.sql:148: ERROR:  role "public" does not exist
ALTER USER nonexistent RESET application_name; -- error
psql:test.sql:149: ERROR:  role "nonexistent" does not exist
-- CREAETE SCHEMA
set client_min_messages to error;
SET
DROP SCHEMA IF EXISTS newschema1;
DROP SCHEMA
DROP SCHEMA IF EXISTS newschema2;
DROP SCHEMA
DROP SCHEMA IF EXISTS newschema3;
DROP SCHEMA
DROP SCHEMA IF EXISTS newschema4;
DROP SCHEMA
DROP SCHEMA IF EXISTS newschema5;
DROP SCHEMA
DROP SCHEMA IF EXISTS newschema6;
DROP SCHEMA
CREATE SCHEMA newschema1 AUTHORIZATION CURRENT_USER;
CREATE SCHEMA
CREATE SCHEMA newschema2 AUTHORIZATION CURRENT_ROLE;
CREATE SCHEMA
CREATE SCHEMA newschema3 AUTHORIZATION USER;
CREATE SCHEMA
CREATE SCHEMA newschema4 AUTHORIZATION SESSION_USER;
CREATE SCHEMA
CREATE SCHEMA newschema5 AUTHORIZATION testrolx;
CREATE SCHEMA
CREATE SCHEMA newschema6 AUTHORIZATION PUBLIC; -- error
psql:test.sql:166: ERROR:  role "public" does not exist
CREATE SCHEMA newschema6 AUTHORIZATION nonexistent; -- error
psql:test.sql:167: ERROR:  role "nonexistent" does not exist
SELECT n.nspname, r.rolname FROM pg_namespace n
 JOIN pg_roles r ON (r.oid = n.nspowner)
 WHERE n.nspname LIKE 'newschema_' ORDER BY 1;
  nspname   | rolname  
------------+----------
 newschema1 | testrol2
 newschema2 | testrol2
 newschema3 | testrol2
 newschema4 | testrol1
 newschema5 | testrolx
(5 rows)

DROP SCHEMA IF EXISTS newschema1;
DROP SCHEMA
DROP SCHEMA IF EXISTS newschema2;
DROP SCHEMA
DROP SCHEMA IF EXISTS newschema3;
DROP SCHEMA
DROP SCHEMA IF EXISTS newschema4;
DROP SCHEMA
DROP SCHEMA IF EXISTS newschema5;
DROP SCHEMA
DROP SCHEMA IF EXISTS newschema6;
DROP SCHEMA
CREATE SCHEMA IF NOT EXISTS newschema1 AUTHORIZATION CURRENT_USER;
CREATE SCHEMA
CREATE SCHEMA IF NOT EXISTS newschema2 AUTHORIZATION CURRENT_ROLE;
CREATE SCHEMA
CREATE SCHEMA IF NOT EXISTS newschema3 AUTHORIZATION USER;
CREATE SCHEMA
CREATE SCHEMA IF NOT EXISTS newschema4 AUTHORIZATION SESSION_USER;
CREATE SCHEMA
CREATE SCHEMA IF NOT EXISTS newschema5 AUTHORIZATION testrolx;
CREATE SCHEMA
CREATE SCHEMA IF NOT EXISTS newschema6 AUTHORIZATION PUBLIC; -- error
psql:test.sql:186: ERROR:  role "public" does not exist
CREATE SCHEMA IF NOT EXISTS newschema6 AUTHORIZATION nonexistent; -- error
psql:test.sql:187: ERROR:  role "nonexistent" does not exist
SELECT n.nspname, r.rolname FROM pg_namespace n
 JOIN pg_roles r ON (r.oid = n.nspowner)
 WHERE n.nspname LIKE 'newschema_' ORDER BY 1;
  nspname   | rolname  
------------+----------
 newschema1 | testrol2
 newschema2 | testrol2
 newschema3 | testrol2
 newschema4 | testrol1
 newschema5 | testrolx
(5 rows)

-- ALTER TABLE OWNER TO
\c testdb testrol0
You are now connected to database "testdb" as user "testrol0".
set client_min_messages to error;
SET
DROP TABLE IF EXISTS testtab1;
DROP TABLE
DROP TABLE IF EXISTS testtab2;
DROP TABLE
DROP TABLE IF EXISTS testtab3;
DROP TABLE
DROP TABLE IF EXISTS testtab4;
DROP TABLE
DROP TABLE IF EXISTS testtab5;
DROP TABLE
DROP TABLE IF EXISTS testtab6;
DROP TABLE
CREATE TABLE testtab1 (a int);
CREATE TABLE
CREATE TABLE testtab2 (a int);
CREATE TABLE
CREATE TABLE testtab3 (a int);
CREATE TABLE
CREATE TABLE testtab4 (a int);
CREATE TABLE
CREATE TABLE testtab5 (a int);
CREATE TABLE
CREATE TABLE testtab6 (a int);
CREATE TABLE
\c testdb testrol1
You are now connected to database "testdb" as user "testrol1".
SET ROLE testrol2;
SET
ALTER TABLE testtab2 OWNER TO CURRENT_USER;
ALTER TABLE
ALTER TABLE testtab3 OWNER TO CURRENT_ROLE;
ALTER TABLE
ALTER TABLE testtab4 OWNER TO USER;
ALTER TABLE
ALTER TABLE testtab5 OWNER TO SESSION_USER;
ALTER TABLE
ALTER TABLE testtab6 OWNER TO testrolx;
ALTER TABLE
ALTER TABLE testtab6 OWNER TO PUBLIC; -- error
psql:test.sql:217: ERROR:  role "public" does not exist
ALTER TABLE testtab6 OWNER TO nonexistent; -- error
psql:test.sql:218: ERROR:  role "nonexistent" does not exist
SELECT c.relname, r.rolname
 FROM pg_class c JOIN pg_roles r ON (r.oid = c.relowner)
 WHERE relname LIKE 'testtab_'
 ORDER BY 1;
 relname  | rolname  
----------+----------
 testtab1 | testrol0
 testtab2 | testrol2
 testtab3 | testrol2
 testtab4 | testrol2
 testtab5 | testrol1
 testtab6 | testrolx
(6 rows)

-- ALTER AGGREGATE
\c testdb testrol0
You are now connected to database "testdb" as user "testrol0".
DROP AGGREGATE IF EXISTS testagg1;
psql:test.sql:227: ERROR:  syntax error at or near ";"
LINE 1: DROP AGGREGATE IF EXISTS testagg1;
                                         ^
DROP AGGREGATE IF EXISTS testagg2;
psql:test.sql:228: ERROR:  syntax error at or near ";"
LINE 1: DROP AGGREGATE IF EXISTS testagg2;
                                         ^
DROP AGGREGATE IF EXISTS testagg3;
psql:test.sql:229: ERROR:  syntax error at or near ";"
LINE 1: DROP AGGREGATE IF EXISTS testagg3;
                                         ^
DROP AGGREGATE IF EXISTS testagg4;
psql:test.sql:230: ERROR:  syntax error at or near ";"
LINE 1: DROP AGGREGATE IF EXISTS testagg4;
                                         ^
DROP AGGREGATE IF EXISTS testagg5;
psql:test.sql:231: ERROR:  syntax error at or near ";"
LINE 1: DROP AGGREGATE IF EXISTS testagg5;
                                         ^
DROP AGGREGATE IF EXISTS testagg6;
psql:test.sql:232: ERROR:  syntax error at or near ";"
LINE 1: DROP AGGREGATE IF EXISTS testagg6;
                                         ^
CREATE AGGREGATE testagg1(int2) (SFUNC = int2_sum, STYPE = int8);
CREATE AGGREGATE
CREATE AGGREGATE testagg2(int2) (SFUNC = int2_sum, STYPE = int8);
CREATE AGGREGATE
CREATE AGGREGATE testagg3(int2) (SFUNC = int2_sum, STYPE = int8);
CREATE AGGREGATE
CREATE AGGREGATE testagg4(int2) (SFUNC = int2_sum, STYPE = int8);
CREATE AGGREGATE
CREATE AGGREGATE testagg5(int2) (SFUNC = int2_sum, STYPE = int8);
CREATE AGGREGATE
CREATE AGGREGATE testagg6(int2) (SFUNC = int2_sum, STYPE = int8);
CREATE AGGREGATE
\c testdb testrol1
You are now connected to database "testdb" as user "testrol1".
SET ROLE testrol2;
SET
ALTER AGGREGATE testagg1(int2) OWNER TO CURRENT_USER;
ALTER AGGREGATE
ALTER AGGREGATE testagg2(int2) OWNER TO CURRENT_ROLE;
ALTER AGGREGATE
ALTER AGGREGATE testagg3(int2) OWNER TO USER;
ALTER AGGREGATE
ALTER AGGREGATE testagg4(int2) OWNER TO SESSION_USER;
ALTER AGGREGATE
ALTER AGGREGATE testagg5(int2) OWNER TO testrolx;
ALTER AGGREGATE
ALTER AGGREGATE testagg6(int2) OWNER TO PUBLIC; -- error
psql:test.sql:249: ERROR:  role "public" does not exist
ALTER AGGREGATE testagg6(int2) OWNER TO nonexistent; -- error
psql:test.sql:250: ERROR:  role "nonexistent" does not exist
SELECT p.proname, r.rolname
 FROM pg_proc p JOIN pg_roles r ON (r.oid = p.proowner)
 WHERE proname LIKE 'testagg_'
 ORDER BY 1;
 proname  | rolname  
----------+----------
 testagg1 | testrol2
 testagg2 | testrol2
 testagg3 | testrol2
 testagg4 | testrol1
 testagg5 | testrolx
 testagg6 | testrol0
(6 rows)

-- ALTER COLLATION, CONVERSION, DATABASE, DOMAIN, FUNCTION, LANGUAGE,
--       LARGEOBJECT, OPERATOR, OPCLASS, OPFAMILY, SCHEMA, TYPE,
--       TABLESPACE, TSDICTIONARY, TSCONFIGURATION, FDW, FOREIGN_SERVER,
--       EVENT_TRIGGER are processed in the same way.
-- See ExecAlterOwner Stmt for details.
-- GRANT/REVOKE : These are not modified by this patch.
GRANT ALL PRIVILEGES ON FUNCTION testagg1(int2)
 TO PUBLIC; -- no error
GRANT
GRANT ALL PRIVILEGES ON FUNCTION testagg2(int2)
 TO testrolx; --no error
GRANT
GRANT ALL PRIVILEGES ON FUNCTION testagg3(int2)
 TO CURRENT_USER; --error
psql:test.sql:269: ERROR:  syntax error at or near "CURRENT_USER"
LINE 2:  TO CURRENT_USER;
            ^
GRANT ALL PRIVILEGES ON FUNCTION testagg4(int2)
 TO CURRENT_ROLE; --error
psql:test.sql:271: ERROR:  syntax error at or near "CURRENT_ROLE"
LINE 2:  TO CURRENT_ROLE;
            ^
GRANT ALL PRIVILEGES ON FUNCTION testagg5(int2)
 TO USER; --error
psql:test.sql:273: ERROR:  syntax error at or near "USER"
LINE 2:  TO USER;
            ^
GRANT ALL PRIVILEGES ON FUNCTION testagg6(int2)
 TO SESSION_USER; --error
psql:test.sql:275: ERROR:  syntax error at or near "SESSION_USER"
LINE 2:  TO SESSION_USER;
            ^
SELECT proname, proacl FROM pg_proc WHERE proname LIKE 'testagg_';
 proname  |                        proacl                         
----------+-------------------------------------------------------
 testagg1 | {=X/testrol2,testrol2=X/testrol2}
 testagg2 | {=X/testrol2,testrol2=X/testrol2,testrolx=X/testrol2}
 testagg3 | 
 testagg4 | 
 testagg5 | 
 testagg6 | 
(6 rows)

REVOKE ALL PRIVILEGES ON FUNCTION testagg1(int2)
 FROM PUBLIC; -- no error
REVOKE
REVOKE ALL PRIVILEGES ON FUNCTION testagg2(int2)
 FROM testrolx; --no error
REVOKE
REVOKE ALL PRIVILEGES ON FUNCTION testagg3(int2)
 FROM CURRENT_USER; --error
psql:test.sql:284: ERROR:  syntax error at or near "CURRENT_USER"
LINE 2:  FROM CURRENT_USER;
              ^
REVOKE ALL PRIVILEGES ON FUNCTION testagg4(int2)
 FROM CURRENT_ROLE; --error
psql:test.sql:286: ERROR:  syntax error at or near "CURRENT_ROLE"
LINE 2:  FROM CURRENT_ROLE;
              ^
REVOKE ALL PRIVILEGES ON FUNCTION testagg5(int2)
 FROM USER; --error
psql:test.sql:288: ERROR:  syntax error at or near "USER"
LINE 2:  FROM USER;
              ^
REVOKE ALL PRIVILEGES ON FUNCTION testagg6(int2)
 FROM SESSION_USER; --error
psql:test.sql:290: ERROR:  syntax error at or near "SESSION_USER"
LINE 2:  FROM SESSION_USER;
              ^
SELECT proname, proacl FROM pg_proc WHERE proname LIKE 'testagg_';
 proname  |              proacl               
----------+-----------------------------------
 testagg1 | {testrol2=X/testrol2}
 testagg2 | {=X/testrol2,testrol2=X/testrol2}
 testagg3 | 
 testagg4 | 
 testagg5 | 
 testagg6 | 
(6 rows)

