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 1qIBP8-0004VS-Rc for pgsql-hackers@arkaria.postgresql.org; Sat, 08 Jul 2023 17:07:30 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1qIBP7-0004uU-OJ for pgsql-hackers@arkaria.postgresql.org; Sat, 08 Jul 2023 17:07:29 +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 1qIBP7-0004u1-Au; Sat, 08 Jul 2023 17:07:29 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qIBP4-002k7m-Qs; Sat, 08 Jul 2023 17:07:28 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 368H7L7h1721888; Sat, 8 Jul 2023 13:07:22 -0400 From: Tom Lane To: Pavel Luzanov cc: "David G. Johnston" , "Jonathan S. Katz" , Robert Haas , David Zhang , "pgsql-hackers@lists.postgresql.org" , rmt@lists.postgresql.org, horikyota.ntt@gmail.com Subject: Re: psql: Add role's membership options to the \du+ command In-reply-to: References: <2977612.1683131109@sss.pgh.pa.us> <39e7431c-1224-ab05-c67c-68f4cf625442@postgrespro.ru> <6b64c59a-fe41-bb07-d0cd-856896412b00@postgresql.org> <7aa3d663-1ea9-de0d-c13a-cbce83902214@postgrespro.ru> <4128935.1687478926@sss.pgh.pa.us> <105356.1687565531@sss.pgh.pa.us> <41517a12-6599-b54b-d30b-3bae906a280b@postgrespro.ru> Comments: In-reply-to Pavel Luzanov message dated "Mon, 26 Jun 2023 22:29:46 +0300" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <1721886.1688836041.1@sss.pgh.pa.us> Date: Sat, 08 Jul 2023 13:07:21 -0400 Message-ID: <1721887.1688836041@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Pavel Luzanov writes: > Please find attached new patch version. > It implements \drg command and hides duplicates in \du & \dg commands. I took a quick look through this, and have some minor suggestions: 1. I was thinking in terms of dropping the "Member of" column entirely in \du and \dg. It doesn't tell you enough, and the output of those commands is often too wide already. 2. You have describeRoleGrants() set up to localize "ADMIN", "INHERIT", and "SET". Since those are SQL keywords, our usual practice is to not localize them; this'd simplify the code. 3. Not sure about use of LEFT JOIN in the query. That will mean we get a row out even for roles that have no grants, which seems like clutter. The LEFT JOINs to r and g are fine, but I suggest changing the first join to a plain join. Beyond those nits, I think this is a good approach and we should adopt it (including in v16). regards, tom lane