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 1pk7wz-0005rx-EA for pgsql-hackers@arkaria.postgresql.org; Wed, 05 Apr 2023 18:33:41 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1pk7wy-0002Aa-A8 for pgsql-hackers@arkaria.postgresql.org; Wed, 05 Apr 2023 18:33:40 +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 1pk7wx-0002AO-WB for pgsql-hackers@lists.postgresql.org; Wed, 05 Apr 2023 18:33:40 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pk7wv-0007Sf-QP for pgsql-hackers@lists.postgresql.org; Wed, 05 Apr 2023 18:33:39 +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 335IXXBE2016651; Wed, 5 Apr 2023 14:33:33 -0400 From: Tom Lane To: Amit Langote cc: vignesh C , Alvaro Herrera , PostgreSQL Hackers Subject: Re: on placeholder entries in view rule action query's range table In-reply-to: References: <20221208091245.k2bgz7one53dulef@alvherre.pgsql> <3684848.1673211536@sss.pgh.pa.us> <782120.1673485582@sss.pgh.pa.us> Comments: In-reply-to Amit Langote message dated "Wed, 05 Apr 2023 11:32:31 +0900" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <2016649.1680719613.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Wed, 05 Apr 2023 14:33:33 -0400 Message-ID: <2016650.1680719613@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Amit Langote writes: > While thinking about query view locking in context of [1], I realized > that we have missed also fixing AcquirePlannerLocks() / > ScanQueryForLocks() to consider that an RTE_SUBQUERY rte may belong to > a view, which must be locked the same as RTE_RELATION entries. I think you're right about that, because AcquirePlannerLocks is supposed to reacquire whatever locks parsing+rewriting would have gotten. However, what's with this hunk? @@ -527,7 +527,7 @@ standard_planner(Query *parse, const char *query_strin= g, int cursorOptions, result->partPruneInfos =3D glob->partPruneInfos; result->rtable =3D glob->finalrtable; result->permInfos =3D glob->finalrteperminfos; - result->viewRelations =3D glob->viewRelations; + result->viewRelations =3D NIL; result->resultRelations =3D glob->resultRelations; result->appendRelations =3D glob->appendRelations; result->subplans =3D glob->subplans; regards, tom lane