pg_table_privileges
Show which roles have SELECT, INSERT, UPDATE, DELETE, etc. privileges on a table or all tables in a schema. Use it to audit who can write or modify tables before a migration.
Instructions
Show which roles have which privileges (SELECT, INSERT, UPDATE, DELETE, TRUNCATE, REFERENCES, TRIGGER) on a table or on every table in a schema. If table is omitted, the result spans every table in schema, ordered by table then grantee. Use this to answer 'who can write to this table?' or to audit schema-wide access before a migration. Visibility caveat: backed by information_schema.table_privileges, which postgres filters by what the calling role can see. A least-privileged role may not see grants involving unrelated third-party roles. For a complete picture, run as a superuser or a member of pg_read_all_data.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| table | No | Table name. Omit to list privileges for all tables in the schema. | |
| schema | No | Schema name (defaults to 'public'). | public |