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

From: David Rowley <dgrowleyml(at)gmail(dot)com>
To: Richard Guo <guofenglinux(at)gmail(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, 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-24 02:05:04
Message-ID: CAApHDvrF+N4tYJLPRvvHirsLo=oiv4VztB3xCLvMLWRuj86OOA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Fri, 22 Mar 2024 at 23:47, Richard Guo <guofenglinux(at)gmail(dot)com> wrote:
> For back branches, the idea of modifying window_ntile_support() and
> int8inc_support() to reject any non-pseudoconstant args also seems
> reasonable to me. One thing I noticed is that sometimes it's not easy
> to tell whether the arg is pseudoconstant or not in the support
> functions, because a pseudoconstant is not necessarily being type of
> Const. For instance, count(1::text) is a CoerceViaIO, and
> ntile(1.0::int) is a FuncExpr. But these are very corner cases and I
> think we can just ignore them.

I don't think that needs anything special aside from constant folding.

I've attached a more complete version of the patch (0002) and another
patch which is what I'd proposed as a fix for the backbranches (0001).
Note quite a few tests needed to be adjusted because of disabling this
optimisation.

The 0002 patch will require a cat version bump as it adds a field to
WindowFunc. Ideally, I'd be applying this fix to master, but I
imagine some people might feel we should delay applying a fix like
this until after we branch for v18. Happy to hear people's views on
that.

David

Attachment Content-Type Size
v2-0001-Disable-run-conditions-for-ntile-var-and-count-va.patch text/plain 12.3 KB
v2-0002-Re-instate-ntile-var-and-count-var-run-condition-.patch text/plain 29.7 KB

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message David Rowley 2024-04-24 02:25:56 Re: BUG #17855: Uninitialised memory used when the name type value processed in binary mode of Memoize
Previous Message PG Bug reporting form 2024-04-23 20:41:02 BUG #18446: Postgres.exe crash observed while installing the application