Re: BUG #17777: An assert failed in nodeWindowAgg.c - Mailing list pgsql-bugs

From David Rowley
Subject Re: BUG #17777: An assert failed in nodeWindowAgg.c
Date
Msg-id CAApHDvpeXSU4A=mzX=96Rdn6u4gjVLHy8SMaVm_g01S8yhfAoQ@mail.gmail.com
Whole thread Raw
In response to Re: BUG #17777: An assert failed in nodeWindowAgg.c  (Andres Freund <andres@anarazel.de>)
Responses Re: BUG #17777: An assert failed in nodeWindowAgg.c  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-bugs
On Sat, 11 Feb 2023 at 13:49, Andres Freund <andres@anarazel.de> wrote:
> I think we could just add a !contain_subplans() to the code deciding whether
> it's safe to use the movable window optimization?

I think this is a fair way to fix the bug.  I think we're pretty
unlikely to disappoint too many people by just disabling the inverse
transitions when the filter has a subplan. I think it'll be rare that
a WindowFunc would even have a filter, let alone one with a subplan.

I think there are other reasons that a subplan might not return the
same thing when it's executed again.  Maybe a synchronous seq scan
looking for some tuple with a subquery containing a LIMIT 1. If the
sync scan started in a different place each time then some other tuple
could be returned.  So I think checking if the filter contains
subplans is a good fix.

Here's a patch for that.

David

Attachment

pgsql-bugs by date:

Previous
From: PG Bug reporting form
Date:
Subject: BUG #17788: Incorrect memory access when parsing empty string as sql_standard interval
Next
From: Tom Lane
Date:
Subject: Re: BUG #17777: An assert failed in nodeWindowAgg.c