pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Pavel Luzanov <p.luzanov@postgrespro.ru>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: David G. Johnston <david.g.johnston@gmail.com>
Cc: Jonathan S. Katz <jkatz@postgresql.org>
Cc: Robert Haas <robertmhaas@gmail.com>
Cc: David Zhang <david.zhang@highgo.ca>
Cc: pgsql-hackers@lists.postgresql.org <pgsql-hackers@lists.postgresql.org>
Cc: rmt@lists.postgresql.org
Cc: horikyota.ntt@gmail.com
Subject: Re: psql: Add role's membership options to the \du+ command
Date: Sun, 9 Jul 2023 13:56:44 +0300
Message-ID: <bb051c99-7f46-77f3-b26e-e0d7ff2c3fe9@postgrespro.ru> (raw)
In-Reply-To: <1721887.1688836041@sss.pgh.pa.us>
References: <b9be2d0e-a9bc-0a30-492f-a4f68e4f7740@postgrespro.ru>
	<CAKFQuwZXQP7ox0jsa+AqKa-4MkTpd2VypJm9dkXsk+6wKEQ2Gg@mail.gmail.com>
	<2977612.1683131109@sss.pgh.pa.us>
	<d61db38b-29d9-81cc-55b3-8a5c704bb969@postgresql.org>
	<CAKFQuwZiomZFLd5zK=feCjY7Weefvce1MR+k38wyBMbaP2ASsg@mail.gmail.com>
	<39e7431c-1224-ab05-c67c-68f4cf625442@postgrespro.ru>
	<6b64c59a-fe41-bb07-d0cd-856896412b00@postgresql.org>
	<7aa3d663-1ea9-de0d-c13a-cbce83902214@postgrespro.ru>
	<CAKFQuwa7EDaN6wzK4TSym8KrN3oSXJmYNEDyWNGRd5qw1pyUFQ@mail.gmail.com>
	<4128935.1687478926@sss.pgh.pa.us>
	<CAKFQuwZ7RDkUMAtBE1hkcpsbEfnRQA__Rii6cW-2fipsHKF6gg@mail.gmail.com>
	<105356.1687565531@sss.pgh.pa.us>
	<CAKFQuwZxCUs=o-jWRUaHOoxBxpB1OTTVSvbz_0ivoSs4UM6KiA@mail.gmail.com>
	<b8624fab-ad13-7933-8afc-976ab106b13a@postgrespro.ru>
	<CAKFQuwad6E0C+=_uk0CFK-x1jfFNeyOOmmaMObDxC5=nyF7Gvg@mail.gmail.com>
	<41517a12-6599-b54b-d30b-3bae906a280b@postgrespro.ru>
	<a3c15b46-29c1-9fbd-88ef-b9! 66ec9c7140@postgrespro.ru>
	<1721887.1688836041@sss.pgh.pa.us>

On 08.07.2023 20:07, Tom Lane wrote:
> 1. I was thinking in terms of dropping the "Member of" column entirely
> in \du and \dg.  It doesn't tell you enough, and the output of those
> commands is often too wide already.

I understood it that way that the dropping "Member of" column will be 
done as part of another work for v17. [1]
But I'm ready to do it now.

> 2. You have describeRoleGrants() set up to localize "ADMIN", "INHERIT",
> and "SET".  Since those are SQL keywords, our usual practice is to not
> localize them; this'd simplify the code.

The reason is that \du has translatable all attributes of the role, 
including NOINHERIT.
I decided to make a new command the same way.
But I'm ready to leave them untranslatable, if no objections.

> 3. Not sure about use of LEFT JOIN in the query.  That will mean we
> get a row out even for roles that have no grants, which seems like
> clutter.  The LEFT JOINs to r and g are fine, but I suggest changing
> the first join to a plain join.

It was David's suggestion:

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:
>
>     * 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.

Personally, I tend to think that left join is not needed. No memberships 
- nothing shown.

So, I accepted all three suggestions. I will wait for other opinions and
plan to implement discussed changes within a few days.

1. https://www.postgresql.org/message-id/4133242.1687481416%40sss.pgh.pa.us

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

view thread (78+ messages)  latest in thread

Message-ID: <bb051c99-7f46-77f3-b26e-e0d7ff2c3fe9@postgrespro.ru>
Permalink:  ../bb051c99-7f46-77f3-b26e-e0d7ff2c3fe9@postgrespro.ru/
Also on:    postgresql.org/message-id/bb051c99-7f46-77f3-b26e-e0d7ff2c3fe9@postgrespro.ru

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-hackers@postgresql.org
  Cc: p.luzanov@postgrespro.ru, tgl@sss.pgh.pa.us, david.g.johnston@gmail.com, jkatz@postgresql.org, robertmhaas@gmail.com, david.zhang@highgo.ca, rmt@lists.postgresql.org, horikyota.ntt@gmail.com
  Subject: Re: psql: Add role's membership options to the \du+ command
  In-Reply-To: <bb051c99-7f46-77f3-b26e-e0d7ff2c3fe9@postgrespro.ru>
  References: <b9be2d0e-a9bc-0a30-492f-a4f68e4f7740@postgrespro.ru> <CAKFQuwZXQP7ox0jsa+AqKa-4MkTpd2VypJm9dkXsk+6wKEQ2Gg@mail.gmail.com> <2977612.1683131109@sss.pgh.pa.us> <d61db38b-29d9-81cc-55b3-8a5c704bb969@postgresql.org> <CAKFQuwZiomZFLd5zK=feCjY7Weefvce1MR+k38wyBMbaP2ASsg@mail.gmail.com> <39e7431c-1224-ab05-c67c-68f4cf625442@postgrespro.ru> <6b64c59a-fe41-bb07-d0cd-856896412b00@postgresql.org> <7aa3d663-1ea9-de0d-c13a-cbce83902214@postgrespro.ru> <CAKFQuwa7EDaN6wzK4TSym8KrN3oSXJmYNEDyWNGRd5qw1pyUFQ@mail.gmail.com> <4128935.1687478926@sss.pgh.pa.us> <CAKFQuwZ7RDkUMAtBE1hkcpsbEfnRQA__Rii6cW-2fipsHKF6gg@mail.gmail.com> <105356.1687565531@sss.pgh.pa.us> <CAKFQuwZxCUs=o-jWRUaHOoxBxpB1OTTVSvbz_0ivoSs4UM6KiA@mail.gmail.com> <b8624fab-ad13-7933-8afc-976ab106b13a@postgrespro.ru> <CAKFQuwad6E0C+=_uk0CFK-x1jfFNeyOOmmaMObDxC5=nyF7Gvg@mail.gmail.com> <41517a12-6599-b54b-d30b-3bae906a280b@postgrespro.ru> <1721887.1688836041@sss.pgh.pa.us> <bb051c99-7f46-77f3-b26e-e0d7ff2c3fe9@postgrespro.ru>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox