Display default access privileges for relations, sequences and functions in Postgres

Clint Pachl picture Clint Pachl · Jan 28, 2013 · Viewed 22.1k times · Source

After altering the default privileges on a Postgres database object, how can you view them?

For instance, if you grant all privileges to role_name for all tables created in the schema schema_name:

ALTER DEFAULT PRIVILEGES IN SCHEMA schema_name GRANT ALL ON TABLES TO role_name;

Answer

Zyphrax picture Zyphrax · Feb 13, 2015

Using the psql(1) interactive terminal

There is another way, at least in recent Postgres versions.
Use the \ddp command

               Default access privileges
     Owner      | Schema |   Type   | Access privileges 
----------------+--------+----------+-------------------
 role_x         |        | function | =X/role_x
 role_x         |        | sequence | 
 role_x         |        | table    | 
 role_x         |        | type     | =U/role_x

Read more about it under the Notes section here:
http://www.postgresql.org/docs/current/static/sql-alterdefaultprivileges.html