Re: Why no pg_has_role(..., 'ADMIN')?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>, Dominique Devienne <ddevienne(at)gmail(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: Why no pg_has_role(..., 'ADMIN')?
Date: 2024-09-20 18:16:38
Message-ID: 2468702.1726856198@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Robert Haas <robertmhaas(at)gmail(dot)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. Do we want to document
all the variants convert_role_priv_string allows? They appear
functionally equivalent, so I'd be inclined to document just one.
'USAGE WITH ADMIN OPTION' seems a reasonable choice.

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2024-09-20 18:34:27 Re: Why no pg_has_role(..., 'ADMIN')?
Previous Message Robert Haas 2024-09-20 16:51:01 Re: Why no pg_has_role(..., 'ADMIN')?