Is there a way to generate the GRANT
statements that have been run on a schema in PostgreSQL, for example if myUser
has been granted usage on mySchema
the script would generate
GRANT USAGE ON SCHEMA mySchema TO myUser;
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It only takes a minute to sign up.
Sign up to join this communityUse pg_dump
pg_dump -d myDatabase --schema mySchema --section=pre-data |
grep '^GRANT'
If you want just the GRANT
on the schema object.
pg_dump -d myDatabase --schema mySchema --section=pre-data |
grep '^GRANT .* ON SCHEMA .* TO'