Last active
July 25, 2025 22:37
-
-
Save msdousti/216171bb61234913e441df8dad448fb3 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 | |
| c.relname, | |
| a.grantor::regrole, | |
| a.grantee::regrole, | |
| c.relowner::regrole, | |
| array_agg(a.privilege_type ORDER BY a.privilege_type) AS privileges | |
| FROM | |
| pg_class c | |
| JOIN pg_namespace n ON c.relnamespace = n.oid | |
| LEFT JOIN aclexplode(c.relacl) AS a ON TRUE | |
| WHERE | |
| n.nspname = 'public' | |
| AND c.relkind IN ('r', 'p') | |
| GROUP BY | |
| 1, 2, 3, 4 | |
| ORDER BY | |
| 1, 2, 3, 4; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment