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 1oVEOD-0008Uw-Aq for pgsql-bugs@arkaria.postgresql.org; Mon, 05 Sep 2022 15:51: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 1oVEOA-0003kV-9j for pgsql-bugs@arkaria.postgresql.org; Mon, 05 Sep 2022 15:51:54 +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 1oVEOA-0003kM-1P for pgsql-bugs@lists.postgresql.org; Mon, 05 Sep 2022 15:51:54 +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 1oVEO7-0003Bi-KA for pgsql-bugs@lists.postgresql.org; Mon, 05 Sep 2022 15:51:53 +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 285Fpkr52435364; Mon, 5 Sep 2022 11:51:46 -0400 From: Tom Lane To: Richard Guo cc: 857348270@qq.com, PostgreSQL mailing lists Subject: Re: BUG #17606: There is still some glitch in 3f7323cbb fixing failure of MULTIEXPR_SUBLINK In-reply-to: References: <17606-e5c8ad18d31db96a@postgresql.org> Comments: In-reply-to Richard Guo message dated "Mon, 05 Sep 2022 22:48:02 +0800" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <2435362.1662393106.1@sss.pgh.pa.us> Date: Mon, 05 Sep 2022 11:51:46 -0400 Message-ID: <2435363.1662393106@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Richard Guo writes: > On Mon, Sep 5, 2022 at 10:25 PM Richard Guo wrote: >> On Mon, Sep 5, 2022 at 3:33 PM PG Bug reporting form < >> noreply@postgresql.org> wrote: >>> 3f7323cbb regenerates its Param for each SubPlan by traversing the >>> targetlist. But ignore one point: initplan is not in targetlist. >>> This will result in a failed assertion, or an error like "unexpected >>> PARAM_MULTIEXPR ID: 131074" >> Since initplan SubPlans do not have args lists, I think it's OK for them >> to share output parameters. So maybe we do not need to do the >> SS_make_multiexprs_unique trick for initplan SubPlans? Yeah, I agree. The initial loop will do nothing anyway since the initplan will no longer have a SubPlan in the tlist. The problem is to get the second loop to not adjust the numbers of the associated output Params. > If I consider it correctly, can we fix the initplan SubPlan issue simply > as below? No, that'll malfunction if there's a mix of initplan and subplan MULTIEXPRs. I think we're going to have to bite the bullet and find a way to discover the SubLinkIds of the non-initplan MULTIEXPRs, so that the second loop can identify which Params to change and which not to. AFAIR that info's no longer available by the time we get here, so I imagine that a fix will require recording some more data during SubLink-to-SubPlan conversion. I'm sure glad that this isn't stuff we're going to need to carry into the future... regards, tom lane