From: | jian he <jian(dot)universality(at)gmail(dot)com> |
---|---|
To: | richard coleman <rcoleman(dot)ascentgl(at)gmail(dot)com> |
Cc: | pgsql-admin(at)lists(dot)postgresql(dot)org |
Subject: | Re: how to list privileges on the database object itself via SQL? |
Date: | 2023-04-28 12:36:19 |
Message-ID: | CACJufxFVQuZyRD5JzMD=SJ7uZ_w+Q5wrP4RUJxRyeZ6Gz412yA@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-admin |
On Thu, Apr 27, 2023 at 12:34 AM richard coleman <
rcoleman(dot)ascentgl(at)gmail(dot)com> wrote:
> All,
>
> This might sound like a silly question, but how would I list the
> privileges the various roles have on the database objects themselves?
>
> There appear to be a million ways to list the privileges on various
> database objects; tables, views, foreign tables, etc. but for the life of
> me there doesn't appear to an analogous way to get permissions on the
> database objects themselves.
>
> At the moment all that I've found is:
>
> select has_database_privilege('role','db_name', 'CREATE') as can_create;
> select has_database_privilege('role','db_name', 'CONNECT') as can_connect;
> select has_database_privilege('role','db_name', 'TEMP') as can_temp;
>
> Am I missing something?
>
> Thanks,
> rik.
>
I found this is more right than the aclexplode function.
to make it one query, then you need to construct a values table like CROSS
JOIN (values('CREATE'), ('CONNECT'), ('TEMPORARY')) s(priv)
also join view pg_roles.
I don't think aclexplode can handle grants on roles. like grant alice to bob
From | Date | Subject | |
---|---|---|---|
Next Message | Wetmore, Matthew (CTR) | 2023-04-28 13:06:14 | how to list privileges on the database object itself via SQL? |
Previous Message | Inzamam Shafiq | 2023-04-28 12:27:36 | Re: how to list privileges on the database object itself via SQL? |