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 1pIY17-0000nj-3v for pgsql-committers@arkaria.postgresql.org; Thu, 19 Jan 2023 16:43:57 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1pIY15-00085Z-CL for pgsql-committers@arkaria.postgresql.org; Thu, 19 Jan 2023 16:43:55 +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 1pIY15-00085Q-5T for pgsql-committers@lists.postgresql.org; Thu, 19 Jan 2023 16:43:55 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pIY12-0006hw-Mp for pgsql-committers@lists.postgresql.org; Thu, 19 Jan 2023 16:43:54 +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 30JGhl5g4069770; Thu, 19 Jan 2023 11:43:47 -0500 From: Tom Lane To: Alvaro Herrera cc: pgsql-committers@lists.postgresql.org, Amit Langote Subject: Re: pgsql: Remove some dead code in selfuncs.c In-reply-to: <4063400.1674143134@sss.pgh.pa.us> References: <4063400.1674143134@sss.pgh.pa.us> Comments: In-reply-to Tom Lane message dated "Thu, 19 Jan 2023 10:45:34 -0500" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <4069768.1674146627.1@sss.pgh.pa.us> Date: Thu, 19 Jan 2023 11:43:47 -0500 Message-ID: <4069769.1674146627@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk I wrote: > Alvaro Herrera writes: >> Remove some dead code in selfuncs.c >> RelOptInfo.userid is the same for all relations in a given inheritance >> tree, so the code in examine_variable() and example_simple_variable() >> that repeats the ACL checks on the root parent rel instead of a given >> leaf child relations need not recompute userid too. > This change seems rather ill-advised. Ah, sorry, -ENOCAFFEINE. It's talking about the access-as-user field, not the relation's owner. I agree that as querytrees are currently built, this is probably a safe optimization. But do we really want to hard-wire such a subtle assumption to gain a microscopic speed benefit? It's not as though GetUserId() is expensive. regards, tom lane