Re: psql: Add role's membership options to the \du+ command
David G. Johnston <david.g.johnston@gmail.com>
From: "David G. Johnston" <david.g.johnston@gmail.com>
To: Pavel Luzanov <p.luzanov@postgrespro.ru>
Cc: David Zhang <david.zhang@highgo.ca>, "pgsql-hackers@lists.postgresql.org" <pgsql-hackers@lists.postgresql.org>
Date: 2023-03-08T02:31:42Z
Lists: 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> — admin option, <literal>i</literal>
— inherit option,
- <literal>s</literal> — 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.
Commits
-
Add psql \drg command to display role grants.
- d65ddaca93f6 17.0 landed
- 0a1d2a7df852 16.0 landed