Re: psql: Add role's membership options to the \du+ command

Pavel Luzanov <p.luzanov@postgrespro.ru>

From: Pavel Luzanov <p.luzanov@postgrespro.ru>
To: "David G. Johnston" <david.g.johnston@gmail.com>
Cc: Tom Lane <tgl@sss.pgh.pa.us>, "Jonathan S. Katz" <jkatz@postgresql.org>, Robert Haas <robertmhaas@gmail.com>, David Zhang <david.zhang@highgo.ca>, "pgsql-hackers@lists.postgresql.org" <pgsql-hackers@lists.postgresql.org>, rmt@lists.postgresql.org, horikyota.ntt@gmail.com
Date: 2023-06-25T14:44:51Z
Lists: pgsql-hackers
On 24.06.2023 18:57, David G. Johnston wrote:
> On Sat, Jun 24, 2023 at 8:11 AM Pavel Luzanov 
> <p.luzanov@postgrespro.ru> wrote:
>
>     There are two commands showing the same information about roles:
>     \du and
>     \dr.
>
>
> I would add \dr as the new official command to complement adding \drg 
> and deprecate both \du and \dg.  Though actual removal and 
> de-documenting doesn't seem like a good idea. But if we ever did 
> assign something non-role to \dr it would be very confusing.

It's my mistake and inattention. I was thinking about '\du' and '\dg', 
and wrote about '\du' and '\dr'.
I agree that \dr and \drg the best names.
So, now concentrating on implementing \drg.

>     * The new meta-command will also make sense for versions <16.
>     The ADMIN OPTION is available in all supported versions.
>
>
> Doesn't every role pre-16 gain SET permission?  We can also deduce 
> whether the grant provides INHERIT based upon the attribute of the 
> role in question.

Indeed! I will do so.

>
>
>     * The new meta-command will not show all roles. It will only show the
>     roles included in other roles.
>     To show all roles you need to add an outer join between pg_roles and
>     pg_auth_members.
>     But all columns except "role" will be left blank. Is it worth
>     doing this?
>
>
> I'm inclined to want this.  I would be good when specifying a role to 
> filter upon that all rows that do exist matching that filter end up in 
> the output regardless if they are standalone or not.

Ok

-- 
Pavel Luzanov
Postgres Professional:https://postgrespro.com

Commits

  1. Add psql \drg command to display role grants.