Re: BUG #18305: Unexpected error: "WindowFunc not found in subplan target lists" triggered by subqueries

From: David Rowley <dgrowleyml(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Richard Guo <guofenglinux(at)gmail(dot)com>, zuming(dot)jiang(at)inf(dot)ethz(dot)ch, pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #18305: Unexpected error: "WindowFunc not found in subplan target lists" triggered by subqueries
Date: 2024-04-29 21:39:46
Message-ID: CAApHDvqL3sJZGgiUZC4s11_wF-dr3dY=EoG2fyCyyJT7kZ5SmA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Fri, 26 Apr 2024 at 03:39, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> It'd be easier to review this if you presented it as two independent
> patches, one for HEAD and one for the back branches.

The attached v2 is the same patch as earlier and is intended for <= v16.

> The fact that you had to use a cheesy "eval_const_expressions(NULL,
> ..." call in 0001 demonstrates that it was a mistake to not include
> PlannerInfo in SupportRequestWFuncMonotonic, as every other planner-
> invoked support request has. I realize that we can't change that
> in back branches, and that it's no longer immediately necessary
> in HEAD either after 0002. But let's learn from experience and
> add it to the struct while we're here.

The correct PlannerInfo to set here would be the one that the
WindowFunc belongs to. The problem is that this code is called from
set_subquery_pathlist before the rel->subroot = subquery_planner. i.e
we've no PlannerInfo to set. Maybe it's worth doing this for
SupportRequestOptimizeWindowClause as a separate patch.

> catversion bumps are not a problem at this stage

The attached v3 is a separate patch for v17 only.

David

Attachment Content-Type Size
v2-0001-Disable-run-conditions-for-ntile-var-and-count-va.patch text/plain 12.3 KB
v3-0001-Fix-query-pullup-issue-with-WindowClause-runCondi.patch text/plain 19.6 KB

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Thomas Munro 2024-04-29 22:03:42 Re: edb installation failed for pgadmin when username is Chinese under c;\user #7432
Previous Message Laurenz Albe 2024-04-29 17:32:17 Re: edb installation failed for pgadmin when username is Chinese under c;\user #7432