I have a group role that consists of around 1,000 users. Those users do not inherit group role permissions, and I would like to make them all inherit them instead.
What would be the way to do it without writing 1,000 lines of PostgreSQL code?
Use psql
's \gexec
and a metadata query:
SELECT format('ALTER ROLE %s INHERIT', member::regrole)
FROM pg_auth_members
WHERE roleid = 'groupname'::regrole \gexec