From: | Pavel Luzanov <p(dot)luzanov(at)postgrespro(dot)ru> |
---|---|
To: | "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | 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> |
Subject: | Re: psql: Add role's membership options to the \du+ command |
Date: | 2023-04-13 12:44:20 |
Message-ID: | e9ef999a-7dad-242a-9e71-fdc2901ad245@postgrespro.ru |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
After playing with the \du command, I found that we can't avoid translation.
All attributes are translatable. Also, two of nine attributes shows in
new line separated format (connection limit and password valid until).
$ LANGUAGE=fr psql -c "ALTER ROLE postgres CONNECTION LIMIT 3 VALID
UNTIL 'infinity'" -c '\du'
ALTER ROLE
Liste des rôles
Nom du rôle | Attributs | Membre de
-------------+---------------------------------------------------------------------------------+-----------
postgres | Superutilisateur, Créer un rôle, Créer une base,
Réplication, Contournement RLS+| {}
| 3 connexions +|
| Mot de passe valide jusqu'à
infinity |
So I decided to keep the format suggested by David, but without
abbreviations and only for extended mode.
$ psql -c '\duS+'
List of roles
Role name | Attributes
| Member of | Description
-----------------------------+-------------------------------+---------------------------------------------------+-------------
pg_checkpoint | Cannot login
| |
pg_create_subscription | Cannot login
| |
pg_database_owner | Cannot login
| |
pg_execute_server_program | Cannot login
| |
pg_maintain | Cannot login
| |
pg_monitor | Cannot login |
pg_read_all_settings from postgres (inherit, set)+|
| |
pg_read_all_stats from postgres (inherit, set) +|
| |
pg_stat_scan_tables from postgres (inherit, set) |
pg_read_all_data | Cannot login
| |
pg_read_all_settings | Cannot login
| |
pg_read_all_stats | Cannot login
| |
pg_read_server_files | Cannot login
| |
pg_signal_backend | Cannot login
| |
pg_stat_scan_tables | Cannot login
| |
pg_use_reserved_connections | Cannot login
| |
pg_write_all_data | Cannot login
| |
pg_write_server_files | Cannot login
| |
postgres | Superuser
+| |
| Create role
+| |
| Create DB
+| |
| Replication
+| |
| Bypass RLS
+| |
| 3 connections
+| |
| Password valid until infinity
| |
Please look at new version. I understand that this is a compromise choice.
I am ready to change it if a better solution is offered.
P.S. If no objections I plan to add this patch to Open Items for v16
https://wiki.postgresql.org/wiki/PostgreSQL_16_Open_Items
On 05.04.2023 17:24, David G. Johnston wrote:
> On Wed, Apr 5, 2023 at 6:58 AM Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>
> Pavel Luzanov <p(dot)luzanov(at)postgrespro(dot)ru> writes:
> > What if this long output will be available only for \du+, and
> for \du
> > just show distinct (without duplicates)
> > roles in the current array format? For those, who don't care
> about these
> > new membership options, nothing will change.
> > Those, who need details will use the + modifier.
> > ?
>
> I kind of like that. Would we change to newlines in the Attributes
> field in both \du and \du+? (I'm +1 for that, but maybe others
> aren't.)
>
>
> If we don't change the \du "Member of" column display (aside from
> removing duplicates) I'm disinclined to change the Attributes column.
>
> I too am partial to only exposing this detail on the extended (+) display.
>
> David J.
>
--
Pavel Luzanov
Postgres Professional:https://postgrespro.com
Attachment | Content-Type | Size |
---|---|---|
v7-0001-psql-show-membership-options-in-the-du-command.patch | text/x-patch | 16.2 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Stephen Frost | 2023-04-13 12:58:59 | Re: longfin missing gssapi_ext.h |
Previous Message | David Rowley | 2023-04-13 12:24:20 | Re: Protecting allocator headers with Valgrind |