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

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: Pavel Luzanov <p(dot)luzanov(at)postgrespro(dot)ru>
Cc: David Zhang <david(dot)zhang(at)highgo(dot)ca>, "pgsql-hackers(at)lists(dot)postgresql(dot)org" <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: psql: Add role's membership options to the \du+ command
Date: 2023-02-17 16:53:35
Message-ID: CAKFQuwYZ3S_A1ZKdnmOv-LueO1683UZf7AocNFTDjwEMLVfMOA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Feb 17, 2023 at 4:02 AM Pavel Luzanov <p(dot)luzanov(at)postgrespro(dot)ru>
wrote:

> List of roles
> Role name | Attributes |
> Member of
>
> -----------+------------------------------------------------------------+-----------
> admin | Create role |
> {bob,bob}
> bob | |
> {}
> postgres | Superuser, Create role, Create DB, Replication, Bypass RLS |
> {}
>
> First 'grant bob to admin' command issued immediately after creating role
> bob by superuser(grantor=10). Second command issues by admin role and set
> membership options SET and INHERIT.
> If we don't ready to display membership options with \du+ may be at least
> we must group records in 'Member of' column for \du command?
>

I agree that these views should GROUP BY roleid and use bool_or(*_option)
to produce their result. Their purpose is to communicate the current
effective state to the user, not facilitate full inspection of the
configuration, possibly to aid in issuing GRANT and REVOKE commands.

One thing I found, and I plan to bring this up independently once I've
collected my thoughts, is that pg_has_role() uses the terminology "USAGE"
and "MEMBER" for "INHERIT" and "SET" respectively.

It's annoying that "member" has been overloaded here. And the choice of
USAGE just seems arbitrary (though I haven't researched it) given the
related syntax.

https://www.postgresql.org/docs/15/functions-info.html

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Jacob Champion 2023-02-17 17:01:43 Re: [PATCH] Align GSS and TLS error handling in PQconnectPoll()
Previous Message Jonah H. Harris 2023-02-17 16:46:03 Re: Reducing System Allocator Thrashing of ExecutorState to Alleviate FDW-related Performance Degradations