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

From: Pavel Luzanov <p(dot)luzanov(at)postgrespro(dot)ru>
To: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>, "Jonathan S(dot) Katz" <jkatz(at)postgresql(dot)org>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Robert Haas <robertmhaas(at)gmail(dot)com>, 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>, rmt(at)lists(dot)postgresql(dot)org, horikyota(dot)ntt(at)gmail(dot)com
Subject: Re: psql: Add role's membership options to the \du+ command
Date: 2023-05-07 19:14:41
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On 05.05.2023 19:51, David G. Johnston wrote:
> But if it is really a blocker then maybe we should produce 3 separate
> newline separated columns, one for the member of role, one for the
> list of attributes, and one with the grantor.  The column headers can
> be translated more easily as single nouns.  The readability quite
> probably would end up being equivalent (maybe even better) in tabular
> form instead of sentence form.

Just to visualize this approach. Below are the output for the tabular
form and the sentence form from last patch version (sql script attached):

Tabular form     rolname      |     memberof     |       options      
|     grantor
------------------+------------------+---------------------+------------------ postgres        
|                  |                     |  regress_du_admin |
regress_du_role0+| admin, inherit, set+| postgres       
+                  | regress_du_role1+| admin, inherit, set+|
postgres        +                  | regress_du_role2 | admin, inherit,
set | postgres regress_du_role0 |                  |                    
|  regress_du_role1 | regress_du_role0+| admin, inherit, set+|
regress_du_admin+                  | regress_du_role0+|
inherit            +| regress_du_role1+                  |
regress_du_role0 | set                 |
regress_du_role2 regress_du_role2 | regress_du_role0+|
admin              +| regress_du_admin+                  |
regress_du_role0+| inherit, set       +|
regress_du_role1+                  | regress_du_role0+|
empty              +| regress_du_role2+                  |
regress_du_role1 | admin, set          | regress_du_admin(5
rows)Sentence form from patch v7     rolname     
|                           memberof
------------------+-------------------------------------------------------------- postgres        
|  regress_du_admin | regress_du_role0 from postgres (admin, inherit,
set)        +                  | regress_du_role1 from postgres (admin,
inherit, set)        +                  | regress_du_role2 from postgres
(admin, inherit, set) regress_du_role0 |  regress_du_role1 |
regress_du_role0 from regress_du_admin (admin, inherit,
set)+                  | regress_du_role0 from regress_du_role1
(inherit)            +                  | regress_du_role0 from
regress_du_role2 (set) regress_du_role2 | regress_du_role0 from
regress_du_admin (admin)              +                  |
regress_du_role0 from regress_du_role1 (inherit, set)      
+                  | regress_du_role0 from regress_du_role2
(empty)              +                  | regress_du_role1 from
regress_du_admin (admin, set)(5 rows)

The tabular form solves the latest patch translation problems mentioned by Kyotaro.
But it requires mapping elements between 3 array-like columns.

To move forward, needs more opinions?

Pavel Luzanov

Attachment Content-Type Size
t.sql application/sql 3.1 KB

In response to


Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2023-05-07 22:26:23 Re: Add LZ4 compression in pg_dump
Previous Message Alvaro Herrera 2023-05-07 17:06:09 Re: MERGE lacks ruleutils.c decompiling support!?