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-03-08 02:31:42
Message-ID: CAKFQuwZTK7z=+rJkgbaZE=4H6FPxBJhbXBvKuR7e_vUXbPQEZw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Mar 7, 2023 at 2:02 PM David G. Johnston <david(dot)g(dot)johnston(at)gmail(dot)com>
wrote:

>
> I'll be looking over your v3 patch sometime this week, if not today.
>
>
Moving the goal posts for this meta-command to >= 9.5 seems like it should
be done as a separate patch and thread. The documentation presently states
we are targeting 9.2 and newer.

My suggestion for the docs is below. I find saying "additional
information is shown...currently this adds the comment". Repeating that
"+" means (show more) everywhere seems excessive, just state what those
"more" things are. I consider \dFp and \dl to be good examples in this
regard.

I also think that "Wall of text" doesn't serve us well. See \dP for
permission to use paragraphs.

I didn't modify \du to match; keeping those in sync (as opposed to having
\du just say "see \dg") seems acceptable.

You had the direction of membership wrong in your copy: "For each
membership in the role" describes the reverse of "Member of" which is what
the column is. The actual format template is constructed properly.

--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -1727,15 +1727,18 @@ INSERT INTO tbl1 VALUES ($1, $2) \bind 'first
value' 'second value' \g
<literal>S</literal> modifier to include system roles.
If <replaceable class="parameter">pattern</replaceable> is
specified,
only those roles whose names match the pattern are listed.
- For each membership in the role, the membership options and
- the role that granted the membership are displayed.
- Оne-letter abbreviations are used for membership options:
- <literal>a</literal> &mdash; admin option, <literal>i</literal>
&mdash; inherit option,
- <literal>s</literal> &mdash; set option and
<literal>empty</literal> if no one is set.
- See <link linkend="sql-grant"><command>GRANT</command></link>
command for their meaning.
- If the form <literal>\dg+</literal> is used, additional information
- is shown about each role; currently this adds the comment for each
- role.
+ </para>
+ <para>
+ Shown within each row, in newline-separated format, are the
memberships granted to
+ the role. The presentation includes both the name of the grantor
+ as well as the membership permissions (in an abbreviated format:
+ <literal>a</literal> for admin option, <literal>i</literal> for
inherit option,
+ <literal>s</literal> for set option.) The word
<literal>empty</literal> is printed in
+ the case that none of those permissions are granted.
+ See the <link linkend="sql-grant"><command>GRANT</command></link>
command for their meaning.
+ </para>
+ <para>
+ If the form <literal>\dg+</literal> is used the comment attached
to the role is shown.
</para>
</listitem>
</varlistentry>

I would suggest tweaking the test output to include regress_du_admin and
also to make regress_du_admin a CREATEROLE role with LOGIN.

I'll need to update the Role Graph View to add the spaces and swap the
order of the "s" and "i" symbols.

David J.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message shiy.fnst@fujitsu.com 2023-03-08 02:43:56 RE: [PATCH] Use indexes on the subscriber when REPLICA IDENTITY is full on the publisher
Previous Message Andres Freund 2023-03-08 02:26:21 Re: buildfarm + meson