Skip to content

Instantly share code, notes, and snippets.

@graphbear
Created July 12, 2017 01:13
Show Gist options
  • Save graphbear/7dd4c1ca3f3cc7f5cca57c67c2b9798a to your computer and use it in GitHub Desktop.
Save graphbear/7dd4c1ca3f3cc7f5cca57c67c2b9798a to your computer and use it in GitHub Desktop.
list all tables for which user or role has privileges
SELECT
schemaname||'.'||tablename
FROM
pg_tables
WHERE
has_table_privilege (
'user or role name',
schemaname||'.'||tablename,
'select'
)
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