Created
July 12, 2017 01:13
-
-
Save graphbear/7dd4c1ca3f3cc7f5cca57c67c2b9798a to your computer and use it in GitHub Desktop.
list all tables for which user or role has privileges
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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