Re: BUG #18305: Unexpected error: "WindowFunc not found in subplan target lists" triggered by subqueries - Mailing list pgsql-bugs

From David Rowley
Subject Re: BUG #18305: Unexpected error: "WindowFunc not found in subplan target lists" triggered by subqueries
Date
Msg-id CAApHDvrF+N4tYJLPRvvHirsLo=oiv4VztB3xCLvMLWRuj86OOA@mail.gmail.com
Whole thread Raw
In response to Re: BUG #18305: Unexpected error: "WindowFunc not found in subplan target lists" triggered by subqueries  (Richard Guo <guofenglinux@gmail.com>)
Responses Re: BUG #18305: Unexpected error: "WindowFunc not found in subplan target lists" triggered by subqueries
List pgsql-bugs
On Fri, 22 Mar 2024 at 23:47, Richard Guo <guofenglinux@gmail.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

pgsql-bugs by date:

Previous
From: PG Bug reporting form
Date:
Subject: BUG #18446: Postgres.exe crash observed while installing the application
Next
From: David Rowley
Date:
Subject: Re: BUG #17855: Uninitialised memory used when the name type value processed in binary mode of Memoize