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 1pPi0l-0005vo-F7 for pgsql-hackers@arkaria.postgresql.org; Wed, 08 Feb 2023 10:49:11 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1pPi0j-0000zU-I6 for pgsql-hackers@arkaria.postgresql.org; Wed, 08 Feb 2023 10:49:09 +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 1pPi0j-0000uf-8J for pgsql-hackers@lists.postgresql.org; Wed, 08 Feb 2023 10:49:09 +0000 Received: from wnew2-smtp.messagingengine.com ([64.147.123.27]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pPi0g-0004tL-GB for pgsql-hackers@postgresql.org; Wed, 08 Feb 2023 10:49:07 +0000 Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailnew.west.internal (Postfix) with ESMTP id 044312B066B4; Wed, 8 Feb 2023 05:49:03 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute1.internal (MEProxy); Wed, 08 Feb 2023 05:49:04 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:reply-to:sender :subject:subject:to:to:x-me-proxy:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm1; t=1675853343; x=1675860543; bh=W 462XLUvx4SSb9SyYqZdYYvhKH+6cUb9LmNIJwDP6kQ=; b=fTHchaMinFqbOYgFG BIMErVGxRC7eD0ZP7PbuiKlu2nFnJvLPvLyX6NZTQgdZxaDtrR8AoiAYp/fwZwXD MwSNKWioK8drNWDVL/ODZLv8g1LeY7x0KKvB+bx4baq9Q87LrwiqHWlPqv3E78s4 yegDAzxG/U4sXt0sPsF4CEMgRGFgHiGT0AzDl1ak0c5aOtWn8y5RjOSvUckkeAFb E9uW7m5XZjTJJXE21ur1R7aQMjipprP4JxIz5EsAQsO4CIYyZMVtkvNNzP0Wc94b RVIAHYNY0Ub+Qa5Dzoi9TCr5fqcrqxza0vgdFy1b0mEkty/g4b39ecnbsDCkfYMf C/9UA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrudehtddgudelucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepfffhvfevuffkgggtugfgjgesthekredttddtjeenucfhrhhomheptehlvhgr rhhoucfjvghrrhgvrhgruceorghlvhhhvghrrhgvsegrlhhvhhdrnhhoqdhiphdrohhrgh eqnecuggftrfgrthhtvghrnhepvdektdffudfftdffffehfffhjeejhffgieeuueekjeek fffgudffhfduffffueevnecuffhomhgrihhnpegvnhhtvghrphhrihhsvggusgdrtghomh enucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpegrlhhv hhgvrhhrvgesrghlvhhhrdhnohdqihhprdhorhhg X-ME-Proxy: Feedback-ID: ia2694551:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 8 Feb 2023 05:49:02 -0500 (EST) Received: by perhan.alvh.no-ip.org (Postfix, from userid 1000) id 407659C; Wed, 8 Feb 2023 11:49:00 +0100 (CET) Date: Wed, 8 Feb 2023 11:49:00 +0100 From: Alvaro Herrera To: o.tselebrovskiy@postgrespro.ru Cc: pgsql-hackers@postgresql.org, s.shinderuk@postgrespro.ru, Amit Langote Subject: Re: A bug with ExecCheckPermissions Message-ID: <20230208104900.fvpikobjumzwqkk3@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <3722b7a2cbe27a1796ee40824bd86dd1@postgrespro.ru> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 2023-Feb-08, o.tselebrovskiy@postgrespro.ru wrote: > But if you debug function ExecCheckPermissions and look into what is passed > to function (contents of rangeTable and rteperminfos to be exact), > you'll see some strange behaviour: > Both of RangeTableEntries have a perminfoindex of 0 and simultaneously have > a RTEPERMISSIONINFO entry for them! Ouch. Yeah, that's not great. As you say, it doesn't really affect anything, and we know full well that these RTEs are ad-hoc manufactured. But as we claim that we still pass the RTEs for the benefit of hooks, then we should at least make them match. I think we should also patch ExecCheckPermissions to use forboth(), scanning the RTEs as it goes over the perminfos, and make sure that the entries are consistent. -- Álvaro Herrera PostgreSQL Developer — https://www.EnterpriseDB.com/