pg.ddx.io pgsql-admin@postgresql.org mailing list archivehelp / 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:07:50 +0200
Message-ID: <df6be05b-60ca-bb2c-4122-48dc03846837@jakobs.com> (raw)
In-Reply-To: <880086.1682532301@sss.pgh.pa.us>
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>
<880086.1682532301@sss.pgh.pa.us>
Am 26.04.23 um 20:05 schrieb Tom Lane:
> richard coleman <rcoleman.ascentgl@gmail.com> writes:
>> Thanks for that. It still seems rather weird that there isn't a more
>> straightforward way to get access to that information.
> You could just read the system catalog documentation:
>
> https://www.postgresql.org/docs/current/catalogs.html
>
> psql's queries are mostly useful as a shortcut to finding out
> where to look.
>
>> Also the SQL generated by psql -E doesn't seem to work on earlier versions
>> of PostgreSQL:
> Yeah, you'd need to try it against a server of the vintage you
> care about. (Also read the documentation of the correct version.)
>
>> Are you saying that the only place this information is stored
>> is in an array in the datacl column of the pg_catalog.pg_database table?
> Precisely.
>
>> If that's the case then I am going to be forced to either write code to
>> parse out that array, or write a looping union of multiple
>> "has_database_privilege()" calls.
> You were already pointed at aclexplode(), which might help.
>
> select datname, a.* from pg_database, aclexplode(datacl) a;
>
> regards, tom lane
>
\df+ aclexplode
in psql will show you more information about the function, which might
help in make good use of it.
--
Holger Jakobs, Bergisch Gladbach, Tel. +49-178-9759012
Attachments:
[application/pgp-signature] OpenPGP_signature (202B, ../df6be05b-60ca-bb2c-4122-48dc03846837@jakobs.com/2-OpenPGP_signature)
download
view thread (26+ messages) latest in thread
Message-ID: <df6be05b-60ca-bb2c-4122-48dc03846837@jakobs.com> Permalink: ../df6be05b-60ca-bb2c-4122-48dc03846837@jakobs.com/ Also on: postgresql.org/message-id/df6be05b-60ca-bb2c-4122-48dc03846837@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: <df6be05b-60ca-bb2c-4122-48dc03846837@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