Re: BUG #17606: There is still some glitch in 3f7323cbb fixing failure of MULTIEXPR_SUBLINK

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Richard Guo <guofenglinux(at)gmail(dot)com>
Cc: 857348270(at)qq(dot)com, PostgreSQL mailing lists <pgsql-bugs(at)lists(dot)postgresql(dot)org>
Subject: Re: BUG #17606: There is still some glitch in 3f7323cbb fixing failure of MULTIEXPR_SUBLINK
Date: 2022-09-06 16:53:41
Message-ID: 3251631.1662483221@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

I wrote:
> After contemplating that for awhile, by far the least painful way
> seems to be to add the subLinkId to struct SubPlan. We can get
> away with that in the back branches as long as we add it at the
> end, since SubPlans don't get recorded in the catalogs.

The attached seems to fix it. While writing a test case I discovered
that the code I'd stolen from ruleutils.c is inadequate for the purpose.
That code was only designed to deal with pre-planning query trees,
so it only expects one Param per targetlist entry --- but cases like
multiple assignments to the same array column can get rolled up into
nests containing several Params (cf. rewriteTargetListIU). So I abandoned
that tactic in favor of just writing a tree walker. Andre's gut feeling
that we needed one was right.

regards, tom lane

Attachment Content-Type Size
fix-multiexpr-renumbering-some-more.patch text/x-diff 15.3 KB

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Sandeep Thakkar 2022-09-07 02:24:16 Re: BUG #17603: Problem running the post-install step. Installation may not complete correctly.
Previous Message Tom Lane 2022-09-06 14:31:48 Re: NULL returned when using RETURNING in main query in combination with a CTE containing FOR UPDATE.