Re: Why no pg_has_role(..., 'ADMIN')? - Mailing list pgsql-general

From Tom Lane
Subject Re: Why no pg_has_role(..., 'ADMIN')?
Date
Msg-id 2470834.1726857267@sss.pgh.pa.us
Whole thread Raw
In response to Re: Why no pg_has_role(..., 'ADMIN')?  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Why no pg_has_role(..., 'ADMIN')?
List pgsql-general
I wrote:
> Robert Haas <robertmhaas@gmail.com> writes:
>> I think this already exists. The full list of modes supported by
>> pg_has_role() is listed in convert_role_priv_string(). You can do
>> something like pg_has_role('alice', 'USAGE WITH ADMIN OPTION'). This
>> is not new: it worked in older releases too, but AFAIK it's never been
>> mentioned in the documentation.

> Surely that's a bad documentation omission.

Actually, it's not true that it's entirely undocumented, because the
text above the table that describes pg_has_role mentions

    Optionally, WITH GRANT OPTION can be added to a privilege type to
    test whether the privilege is held with grant option.

But I concur that it's not immediately obvious that that applies
to role membership, since we don't use the "grant option" terminology
for roles.

I'm now inclined to add wording within the pg_has_role entry, along
the lines of

    WITH ADMIN OPTION or WITH GRANT OPTION can be added to any of
    these privilege types to test whether ADMIN privilege is held
    (all six spellings test the same thing).

            regards, tom lane



pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: Why no pg_has_role(..., 'ADMIN')?
Next
From: Robert Haas
Date:
Subject: Re: Why no pg_has_role(..., 'ADMIN')?