Re: catalog views to check on grants

Поиск
Список
Период
Сортировка
От Juan José Santamaría Flecha
Тема Re: catalog views to check on grants
Дата
Msg-id CAC+AXB1KNGHMuWs2-FOLjkSxacG=OmCsODDqA1Aomv2s=odenA@mail.gmail.com
обсуждение исходный текст
Ответ на catalog views to check on grants  (Ankush Chawla <ankushchawla03@gmail.com>)
Ответы Re: catalog views to check on grants  (Holger Jakobs <holger@jakobs.com>)
Список pgsql-admin

On Thu, Apr 16, 2020 at 2:11 PM Ankush Chawla <ankushchawla03@gmail.com> wrote:

Please share the dictionary tables to view the grants on objects, system and object privileges etc.

Different objects have a different set of privileges, and there is not a single view for then all. You can check the system catalogs [1] for a specific object and check its privileges as an aclitem[] [2], e.g. for relations you can check pg_class grants using a query like so:

select relname,
       (select rolname from pg_roles where oid = grantor) as grantor,
       (select rolname from pg_roles where oid = grantee) as grantee,
       privilege_type,
       is_grantable
from (select relname,
       (aclexplode(relacl)).grantor,
       (aclexplode(relacl)).grantee,
       (aclexplode(relacl)).privilege_type,
       (aclexplode(relacl)).is_grantable
  from pg_class
  where relacl is not null) as pg_class_privs;

[1] https://www.postgresql.org/docs/current/catalogs.html
[2] https://www.postgresql.org/docs/current/ddl-priv.html#PRIVILEGE-ABBREVS-TABLE

Regards,

Juan José Santamaría Flecha

В списке pgsql-admin по дате отправления:

Предыдущее
От: Ankush Chawla
Дата:
Сообщение: catalog views to check on grants
Следующее
От: Brandon Hsu
Дата:
Сообщение: Re: pgAdmin4 dependency package "python3-psycopg2" should be place in"pgdg-common" repo.