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

From: David Zhang <david(dot)zhang(at)highgo(dot)ca>
To: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
Cc: Pavel Luzanov <p(dot)luzanov(at)postgrespro(dot)ru>, "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-02-15 21:31:05
Message-ID: ee39eff0-3c0d-4367-4595-619fd1763a5d@highgo.ca
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2023-02-10 2:27 p.m., David G. Johnston wrote:
> On Fri, Feb 10, 2023 at 2:08 PM David Zhang <david(dot)zhang(at)highgo(dot)ca> wrote:
>
>
> I noticed the document psql-ref.sgml has been updated for both
> `du+` and
> `dg+`, but only `du` and `\du+` are covered in regression test. Is
> that
> because `dg+` is treated exactly the same as `du+` from testing
> point of
> view?
>
>
> Yes.
>
>
> The reason I am asking this question is that I notice that
> `pg_monitor`
> also has the detailed information, so not sure if more test cases
> required.
>
>
> Of course it does.  Why does that bother you?  And what does that have
> to do with the previous paragraph?

There is a default built-in role `pg_monitor` and the behavior changed
after the patch. If `\dg+` and `\du+` is treated as the same, and `make
check` all pass, then I assume there is no test case to verify the
output of `duS+`. My point is should we consider add a test case?

Before patch the output for `pg_monitor`,

postgres=# \duS+
List of roles
          Role name          | Attributes                         |
Member of                           | Description
-----------------------------+------------------------------------------------------------+--------------------------------------------------------------+-------------
 alice |                                                            |
{pg_read_all_settings,pg_read_all_stats,pg_stat_scan_tables} |
 pg_checkpoint               | 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,pg_read_all_stats,pg_stat_scan_tables} |
 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                                               |
{}                                                           |
 ubuntu                      | Superuser, Create role, Create DB,
Replication, Bypass RLS |
{}                                                           |

After patch the output for `pg_monitor`,

postgres=# \duS+
List of roles
          Role name          | Attributes                        
|                   Member of                   | Description
-----------------------------+------------------------------------------------------------+-----------------------------------------------+-------------
 alice |                                                            |
pg_read_all_settings WITH ADMIN, INHERIT, SET+|
|                                                            |
pg_read_all_stats WITH INHERIT               +|
|                                                            |
pg_stat_scan_tables                           |
 pg_checkpoint               | 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 WITH INHERIT, SET       +|
|                                                            |
pg_read_all_stats WITH INHERIT, SET          +|
|                                                            |
pg_stat_scan_tables WITH 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
|                                               |
 ubuntu                      | Superuser, Create role, Create DB,
Replication, Bypass RLS |                                               |

Best regards,

David

>
> David J.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message David G. Johnston 2023-02-15 21:37:52 Re: psql: Add role's membership options to the \du+ command
Previous Message Joel Jacobson 2023-02-15 21:08:59 [PATCH] FIx alloc_var() ndigits thinko