Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pSPND-0004BN-WB for pgsql-hackers@arkaria.postgresql.org; Wed, 15 Feb 2023 21:31:32 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1pSPN9-0005AT-Cw for pgsql-hackers@arkaria.postgresql.org; Wed, 15 Feb 2023 21:31:27 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pSPN7-0005AG-At for pgsql-hackers@lists.postgresql.org; Wed, 15 Feb 2023 21:31:27 +0000 Received: from sender4-op-o10.zoho.com ([136.143.188.10]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pSPMz-0006s2-Gy for pgsql-hackers@lists.postgresql.org; Wed, 15 Feb 2023 21:31:22 +0000 ARC-Seal: i=1; a=rsa-sha256; t=1676496669; cv=none; d=zohomail.com; s=zohoarc; b=DGzHq/4hlBQF8QD2Jyh87xdD14y2O+/v0Q6qhj4a1mwd3oDHoZ5XcX7e8ZQFggl0rPlDhmZZ/Wiyrf2yMlfBLiOM/L65HJismCzU1ZnshnYx7IYGVGdkekxrQZPAwA6RuZTmNKVykmaTWwH3yhqCWwKvlU1DkVDnKot15SIO1mE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1676496669; h=Content-Type:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=0y87dOVJxf2lCFuPdOpKgToRiL/ZQ66TKDzyduXqnkA=; b=mffS0QUIRvkpAP1mkD1D/o2/H69gdy9U5yhnGB5DDkuqZyizor9MLhOTQI3tgqNbToQ/Fam/gteDJ2A9IW3LsuMjCzJCRBQ43/9A+TzwUCDSje8kLIxK4l3XaVeBuks2IGy3tBtdPbqRdhhPbRDQLUCe65ivY8sTrruqE3mHOuQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=highgo.ca; spf=pass smtp.mailfrom=david.zhang@highgo.ca; dmarc=pass header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1676496669; s=zoho; d=highgo.ca; i=david.zhang@highgo.ca; h=Content-Type:Message-ID:Date:Date:MIME-Version:Subject:Subject:To:To:Cc:Cc:References:From:From:In-Reply-To:Message-Id:Reply-To; bh=0y87dOVJxf2lCFuPdOpKgToRiL/ZQ66TKDzyduXqnkA=; b=cfiIO8kOoDKbJzxy1FU8Ns2ZHJSZNNgd4chOGpzHhvVDAYSoE1SswJ2iL9lvEg8V jNDC3aiSEHDWFiwEmY/SYuEIEB/EZbmTzBYXWvS0RmhbMwBz/Ddj9/hKthIcL7RQbEL BOxnljCZnNpBguOj1615Q54B9EWyroZSvaFSJPNo= Received: from [192.168.1.88] (d66-183-207-156.bchsia.telus.net [66.183.207.156]) by mx.zohomail.com with SMTPS id 1676496666977574.8621293588503; Wed, 15 Feb 2023 13:31:06 -0800 (PST) Content-Type: multipart/alternative; boundary="------------G00j0dgAtLsvr9Vp8zHrg1Ic" Message-ID: Date: Wed, 15 Feb 2023 13:31:05 -0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.6.1 Subject: Re: psql: Add role's membership options to the \du+ command Content-Language: en-US To: "David G. Johnston" Cc: Pavel Luzanov , "pgsql-hackers@lists.postgresql.org" References: From: David Zhang In-Reply-To: X-ZohoMailClient: External List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk This is a multi-part message in MIME format. --------------G00j0dgAtLsvr9Vp8zHrg1Ic Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit On 2023-02-10 2:27 p.m., David G. Johnston wrote: > On Fri, Feb 10, 2023 at 2:08 PM David Zhang 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. --------------G00j0dgAtLsvr9Vp8zHrg1Ic Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 8bit
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.
--------------G00j0dgAtLsvr9Vp8zHrg1Ic--