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 1qJyjB-0003mt-HS for pgsql-hackers@arkaria.postgresql.org; Thu, 13 Jul 2023 15:59:38 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1qJyjA-0000Ar-Cs for pgsql-hackers@arkaria.postgresql.org; Thu, 13 Jul 2023 15:59:36 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1qJyj9-0000Ae-VR; Thu, 13 Jul 2023 15:59:36 +0000 Received: from mail.postgrespro.ru ([93.174.131.139]) by magus.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1qJyj6-000G0h-Ia; Thu, 13 Jul 2023 15:59:35 +0000 Received: from [192.168.0.104] (unknown [62.217.185.60]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) (Authenticated sender: p.luzanov@postgrespro.ru) by mail.postgrespro.ru (Postfix/587) with ESMTPSA id 01E17E20E5C; Thu, 13 Jul 2023 18:59:31 +0300 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=postgrespro.ru; s=mx2023; t=1689263972; bh=RDLP/OyFeEpa2Is7RQHyASdz+5OAbPeeNXwXzWdlkJk=; h=Message-ID:Date:User-Agent:Subject:To:Cc:References:From: In-Reply-To:From; b=VZXk7qXZBzybX57wPDOLg7nTd3+W8l9RoF2k+6VmX2vf3F9R9JvW6LUEtFRC/HKgo AaX/VMqoH5ygGhz6i0dznwoIrs0QRSWII8h2LqcpYW6K22ghfFYF9WMSlDarxxyqI3 AUlc+eBxeEHimegdwBuMdcVNe/wFNE4i7etC2oArJo+HF+CwuT+n4itjJ9DuIESnCv hFtHaNfnYsGyIedzZ9KN5fi19fGr+6+8fGIXzx6LxGm69/7Hd1MyujgYRj6nrIgY4A 0FiPB8T9TFRlvJLeeJBuR3335c+Eh+U9zYacqRVZ4KPEr6utsYzTriXKx8Lo0wQUeh CZAM/ROEqUr+Q== Message-ID: <84651345-5f0d-50c9-ef3f-ad4ba25b9f25@postgrespro.ru> Date: Thu, 13 Jul 2023 18:59:31 +0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.13.0 Subject: Re: psql: Add role's membership options to the \du+ command Content-Language: en-US, ru-RU To: Tom Lane Cc: "David G. Johnston" , "Jonathan S. Katz" , Robert Haas , David Zhang , "pgsql-hackers@lists.postgresql.org" , rmt@lists.postgresql.org, horikyota.ntt@gmail.com References: <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> <1721887.1688836041@sss.p! gh.pa.us> <50ea2597-5e3f-372c-1ea8-5ba4f3edd690@postgrespro.ru> <2879332.1689260497@sss.pgh.pa.us> From: Pavel Luzanov In-Reply-To: <2879332.1689260497@sss.pgh.pa.us> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 13.07.2023 18:01, Tom Lane wrote: > The idea with that, IMO, is to do something at least minimally sane > if there's a bogus role OID in pg_auth_members. With plain joins, > the output row would disappear and you'd have no clue that anything > is wrong. With left joins, you get a row with a null column and > there's reason to investigate why. > > Since such a case should not happen in normal use, I don't think it > counts for discussions about compactness of output. However, this > is also an argument for using a plain not left join between pg_roles > and pg_auth_members: if we do it as per the earlier patch, then > nulls in the output are common and wouldn't draw your attention. > (Indeed, I think broken and not-broken pg_auth_members contents > would be indistinguishable.) It reminds me about defensive programming practices. That's great, thanks for explanation. > That does not seem right. Is it impossible for pam.set_option > to be false? Even if it is, should this code assume that? For versions before 16, including one role to another automatically gives possibility to issue SET ROLE. IMO, the only question is whether it is correct to show IMPLICIT and SET options in versions where they are not actually present in pg_auth_members, but can be determined. -- Pavel Luzanov Postgres Professional: https://postgrespro.com