Re: BUG #19804: "variable not found in subplan target list", DISTINCT agg over Gather`

From: Tender Wang <tndrwang(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: alpkeles99(at)gmail(dot)com, pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #19804: "variable not found in subplan target list", DISTINCT agg over Gather`
Date: 2026-11-29 06:16:27
Message-ID: CAHewXN=Vx4UKh-GiO8u6-hOvMM77ObVhLbjLxRE31nz07sqgcA@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Tender Wang <tndrwang(at)gmail(dot)com> 于2026年11月9日周一 12:41写道:
>
> Hi,
>
> Tender Wang <tndrwang(at)gmail(dot)com> 于2026年10月30日周五 16:08写道:
> >
> > This has become a larger change than I expected, so I am sending it as
> > WIP to get feedback.
> >
>
> Attached is v2.
>
Attached is v3. In v2, callers collected the available projection
inputs before calling prepare_sort_from_pathkeys(), even when every
pathkey matched an existing targetlist entry.
In v3, prepare_sort_from_pathkeys() collects those inputs when it
encounters the first key that needs a new targetlist entry. It reuses
the list for any remaining missing keys and frees it before returning.

--
Tender Wang

Attachment Content-Type Size
v3-0001-Use-available-projection-inputs-when-adding-sort-.patch text/plain 37.4 KB

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message ZizhuanLiu X-MAN 2026-11-29 12:45:31 Re: BUG #19789: "expression not found in statistics object" for a boolean domain column in an MCV statistics object
Previous Message shihao zhong 2026-11-28 18:17:51 Re: BUG #19873: planner silently drops the second ORDER BY sort key when both keys reference the same expression und