Skip to content

Instantly share code, notes, and snippets.

@nomeyer
Created February 12, 2016 15:23
Show Gist options
  • Save nomeyer/afae8e84972ef56f1d8b to your computer and use it in GitHub Desktop.
Save nomeyer/afae8e84972ef56f1d8b to your computer and use it in GitHub Desktop.
PostgresSQL query to show tables on which a given user has permissions of a certain type
select schemaname||'.'||tablename
from pg_tables
where has_table_privilege (
'~~user_name~~',
schemaname||'.'||tablename,
'~~permission_type~~'
)
and schemaname not in (
'pg_catalog',
'information_schema'
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment