Re: how to list privileges on the database object itself via SQL?

From: Holger Jakobs <holger(at)jakobs(dot)com>
To: pgsql-admin(at)lists(dot)postgresql(dot)org
Subject: Re: how to list privileges on the database object itself via SQL?
Date: 2023-04-26 18:22:56
Message-ID: 5d4cc93e-cea0-6b99-53d3-2f0c7a3d6a59@jakobs.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

Try this command:

with cte as (select oid, datname, (aclexplode(datacl)).* from
pg_database where oid>1)
  select cte.oid, datname, grantor.rolname as grantorname,
coalesce(grantee.rolname, 'public') as granteename, privilege_type,
is_grantable
  from cte
  join pg_authid grantor on cte.grantor = grantor.oid
  left join pg_authid grantee on cte.grantee = grantee.oid

--
Holger Jakobs, Bergisch Gladbach, Tel. +49-178-9759012

In response to

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message richard coleman 2023-04-26 18:28:57 Re: how to list privileges on the database object itself via SQL?
Previous Message Erik Wienhold 2023-04-26 18:21:48 Re: how to list privileges on the database object itself via SQL?