Re: psql: Add role's membership options to the \du+ command - Mailing list pgsql-hackers

From David G. Johnston
Subject Re: psql: Add role's membership options to the \du+ command
Date
Msg-id CAKFQuwZTK7z=+rJkgbaZE=4H6FPxBJhbXBvKuR7e_vUXbPQEZw@mail.gmail.com
Whole thread Raw
In response to Re: psql: Add role's membership options to the \du+ command  ("David G. Johnston" <david.g.johnston@gmail.com>)
Responses Re: psql: Add role's membership options to the \du+ command
List pgsql-hackers
On Tue, Mar 7, 2023 at 2:02 PM David G. Johnston <david.g.johnston@gmail.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.

pgsql-hackers by date:

Previous
From: Andres Freund
Date:
Subject: Re: buildfarm + meson
Next
From: "shiy.fnst@fujitsu.com"
Date:
Subject: RE: [PATCH] Use indexes on the subscriber when REPLICA IDENTITY is full on the publisher