pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Holger Jakobs <holger@jakobs.com>
To: pgsql-admin@lists.postgresql.org
Subject: Re: how to list privileges on the database object itself via SQL?
Date: Wed, 26 Apr 2023 20:22:56 +0200
Message-ID: <5d4cc93e-cea0-6b99-53d3-2f0c7a3d6a59@jakobs.com> (raw)
In-Reply-To: <CAGA3vBsPQ8672wf99EGGWDAG4GBTcOpiJeCrJOypQ1sGG02Bvw@mail.gmail.com>
References: <CAGA3vBvanu7UBtaaVv9PH25Ko==5F2wewhPWTTra8wqexdDAdQ@mail.gmail.com>
	<870558.1682527243@sss.pgh.pa.us>
	<CAGA3vBvjUiUb+O-UWYU8VNrrPrLrwz+KOg3zqwiWTAAkTChX_A@mail.gmail.com>
	<875041.1682529779@sss.pgh.pa.us>
	<CAGA3vBsPQ8672wf99EGGWDAG4GBTcOpiJeCrJOypQ1sGG02Bvw@mail.gmail.com>

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



Attachments:

  [application/pgp-signature] OpenPGP_signature (202B, ../5d4cc93e-cea0-6b99-53d3-2f0c7a3d6a59@jakobs.com/2-OpenPGP_signature)
  download

view thread (26+ messages)  latest in thread

Message-ID: <5d4cc93e-cea0-6b99-53d3-2f0c7a3d6a59@jakobs.com>
Permalink:  ../5d4cc93e-cea0-6b99-53d3-2f0c7a3d6a59@jakobs.com/
Also on:    postgresql.org/message-id/5d4cc93e-cea0-6b99-53d3-2f0c7a3d6a59@jakobs.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-admin@postgresql.org
  Cc: holger@jakobs.com, pgsql-admin@lists.postgresql.org
  Subject: Re: how to list privileges on the database object itself via SQL?
  In-Reply-To: <5d4cc93e-cea0-6b99-53d3-2f0c7a3d6a59@jakobs.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox