Re: Test if a database has any privilege granted to public

Поиск
Список
Период
Сортировка
От David G. Johnston
Тема Re: Test if a database has any privilege granted to public
Дата
Msg-id CAKFQuwa1FwVNrL4aZFkGWJL3S7kmcNiJRR=d4pOzsAr6w94xUw@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Test if a database has any privilege granted to public  (Bryn Llewellyn <bryn@yugabyte.com>)
Ответы Re: Test if a database has any privilege granted to public  (Bryn Llewellyn <bryn@yugabyte.com>)
Список pgsql-general
On Thu, Dec 15, 2022 at 12:51 PM Bryn Llewellyn <bryn@yugabyte.com> wrote:

select datname::text
from pg_database
where 0::oid = any(select (aclexplode(datacl)).grantee)
or datacl is null;

That's easy if you know that you need to write this. But the need to do so seems to depend on pretty arcane knowledge that, as far as I can see, isn't documented.


The last paragraph of the privileges documentation says this explicitly:

If the “Access privileges” column is empty for a given object, it means the object has default privileges (that is, its privileges entry in the relevant system catalog is null). Default privileges always include all privileges for the owner, and can include some privileges for PUBLIC depending on the object type, as explained above.


Or, you know, just use the provided functions that have been programmed with knowledge of how the system works.


select has_database_privilege(0,current_database(),'CONNECT');

David J.


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

Предыдущее
От: Bryn Llewellyn
Дата:
Сообщение: Re: Test if a database has any privilege granted to public
Следующее
От: Bryn Llewellyn
Дата:
Сообщение: Re: Test if a database has any privilege granted to public