-- database
select
datname
,HAS_DATABASE_PRIVILEGE(datname, 'create') as create
,HAS_DATABASE_PRIVILEGE(datname, 'temporary') as temporary
from pg_database;
datname | create | temporary
--------------+--------+-----------
dev | f | t
padb_harvest | f | t
template1 | f | f
template0 | f | f
...
-- schema(namespace)
select nspname,
has_schema_privilege(nspname, 'create') as create,
has_schema_privilege(nspname, 'usage') as usage
from pg_namespace;
nspname | create | usage
--------------------+--------+-------
pg_toast | f | f
pg_internal | f | f
pg_temp_1 | f | f
pg_catalog | f | t
information_schema | f | t
public | t | t
...
-- tables in current database
select tablename,
HAS_TABLE_PRIVILEGE(tablename, 'select') as select,
HAS_TABLE_PRIVILEGE(tablename, 'insert') as insert,
HAS_TABLE_PRIVILEGE(tablename, 'update') as update,
HAS_TABLE_PRIVILEGE(tablename, 'delete') as delete,
HAS_TABLE_PRIVILEGE(tablename, 'references') as references
HAS_TABLE_PRIVILEGE(tablename, 'references') as references
from pg_tables where schemaname='public' order by tablename;
tablename | select | insert | update | delete | references
------------+--------+--------+--------+--------+------------
category | t | f | f | f | f
date | t | f | f | f | f
event | t | f | f | f | f
listing | t | f | f | f | f
sales | t | f | f | f | f
users | t | f | f | f | f
venue | t | f | f | f | f
...