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 1n1zNv-0002NZ-4P for pgsql-bugs@arkaria.postgresql.org; Mon, 27 Dec 2021 23:26:31 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1n1zNr-0005t1-OK for pgsql-bugs@arkaria.postgresql.org; Mon, 27 Dec 2021 23:26:27 +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 1n1zNr-0005ss-GE for pgsql-bugs@lists.postgresql.org; Mon, 27 Dec 2021 23:26:27 +0000 Received: from smtp.outgoing.loopia.se ([93.188.3.37]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1n1zNk-00057H-KW for pgsql-bugs@lists.postgresql.org; Mon, 27 Dec 2021 23:26:27 +0000 Received: from s807.loopia.se (localhost [127.0.0.1]) by s807.loopia.se (Postfix) with ESMTP id BE66F2F026D4 for ; Tue, 28 Dec 2021 00:26:18 +0100 (CET) Received: from s630.loopia.se (unknown [172.22.191.6]) by s807.loopia.se (Postfix) with ESMTP id AEE1E2E2961F; Tue, 28 Dec 2021 00:26:18 +0100 (CET) Received: from s898.loopia.se (unknown [172.22.191.5]) by s630.loopia.se (Postfix) with ESMTP id A402213AD06C; Tue, 28 Dec 2021 00:26:18 +0100 (CET) X-Virus-Scanned: amavisd-new at amavis.loopia.se X-Spam-Flag: NO X-Spam-Score: -1 X-Spam-Level: X-Spam-Status: No, score=-1 tagged_above=-999 required=6.2 tests=[ALL_TRUSTED=-1] autolearn=disabled Received: from s499.loopia.se ([172.22.191.6]) by s898.loopia.se (s898.loopia.se [172.22.190.17]) (amavisd-new, port 10024) with LMTP id JBvUjGWqvzIe; Tue, 28 Dec 2021 00:26:18 +0100 (CET) X-Loopia-Auth: user X-Loopia-User: daniel@yesql.se X-Loopia-Originating-IP: 89.255.232.193 Received: from [192.168.72.144] (customer-89-255-232-193.stosn.net [89.255.232.193]) (Authenticated sender: daniel@yesql.se) by s499.loopia.se (Postfix) with ESMTPSA id 20F321CE0836; Tue, 28 Dec 2021 00:26:18 +0100 (CET) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 13.4 \(3608.120.23.2.7\)) Subject: Re: BUG #17346: pg_upgrade fails with role granted by other role From: Daniel Gustafsson In-Reply-To: <1672903.1640645528@sss.pgh.pa.us> Date: Tue, 28 Dec 2021 00:26:17 +0100 Cc: andrewbille@gmail.com, pgsql-bugs@lists.postgresql.org, Peter Eisentraut Content-Transfer-Encoding: quoted-printable Message-Id: <8F7DB6E9-E3A4-411B-AFCC-BF3642ACF309@yesql.se> References: <17346-f72b28bd1a341060@postgresql.org> <1489048.1640620947@sss.pgh.pa.us> <9F4DFF73-49E6-4A6D-9D1F-60B1643FB99E@yesql.se> <1672903.1640645528@sss.pgh.pa.us> To: Tom Lane X-Mailer: Apple Mail (2.3608.120.23.2.7) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk > On 27 Dec 2021, at 23:52, Tom Lane wrote: >=20 > Daniel Gustafsson writes: >> On 27 Dec 2021, at 17:02, Tom Lane wrote: >>> A superuser, or really anyone who's a member of the user1 role, >>> ought to be able to do that (especially since it used to be = allowed). >>> So it seems the permissions check was coded incorrectly. >=20 >> Reading the SQL spec for GRANT and REVOKE, and specifically the = "Grantor >> Determination" subsection, it's not clear to me that this is wrong = *per spec* >> and that any value except CURRENT_USER and CURRENT_ROLE is supported = (which is >> what 6aaaa76bb implemented and the above referenced commit amended). = Given the >> time of day I'm undercaffeinated for spec reading so I might be = missing >> something though. Is really handled differently for = GRANT/REVOKE >> ROLE to PRIVILEGE? >=20 > Not sure. However, it is certainly true that we have long supported > other grantors in GRANT ... GRANTED BY (at least back to 8.4, > I didn't try anything older). Whether that's within the spec or an > extension, breaking the case now isn't okay. Agreed. > So the code change in b2a459edf is flat wrong AFAICS. The fact that > it didn't break any existing test cases says we've got a testing gap, > which probably ought to be filled. >=20 > ISTM that 6aaaa76bb left a lot on the table too; would it have been > that hard to support other roles in the cases it added, given > that (at least most of) the ACL infrastructure is there? I do agree > with the idea that GRANT and GRANT ought to > behave the same on this point --- but we have to do that by adding > capability, not subtracting it. I'll craft a revert of b2a459edf when I'm less tired, a proper fix can = then be worked on separately. -- Daniel Gustafsson https://vmware.com/