In a fictional reporting database, report_job is a member of report_reader. The reader owns an approved read grant, but the job fails without a role switch. An authorized reader can use pg_has_role to check both properties from the existing session.
SELECT pg_has_role('report_job', 'report_reader', 'USAGE') AS inherits_now,
pg_has_role('report_job', 'report_reader', 'SET') AS can_set_role;
If the result is false and true, the job can switch to the reader but does not have its privileges immediately. Inspect the intended session setup and membership options before adding a direct table grant. If both are false, read the membership chain for the relevant options. Keep the server version with the incident receipt because earlier PostgreSQL versions represent inheritance differently. Role membership and inheritance ยท pg_has_role