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

From David Zhang
Subject Re: psql: Add role's membership options to the \du+ command
Date
Msg-id ee39eff0-3c0d-4367-4595-619fd1763a5d@highgo.ca
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 2023-02-10 2:27 p.m., David G. Johnston wrote:
On Fri, Feb 10, 2023 at 2:08 PM David Zhang <david.zhang@highgo.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.

pgsql-hackers by date:

Previous
From: "Joel Jacobson"
Date:
Subject: [PATCH] FIx alloc_var() ndigits thinko
Next
From: "David G. Johnston"
Date:
Subject: Re: psql: Add role's membership options to the \du+ command