Re: BUG #17777: An assert failed in nodeWindowAgg.c
David Rowley <dgrowleyml@gmail.com>
From: David Rowley <dgrowleyml@gmail.com>
To: Andres Freund <andres@anarazel.de>
Cc: Tom Lane <tgl@sss.pgh.pa.us>, xinwen@stu.scu.edu.cn, pgsql-bugs@lists.postgresql.org
Date: 2023-02-12T10:30:25Z
Lists: pgsql-bugs
Attachments
- disable_inverse_transitions_when_filter_has_subplan.patch (text/plain) patch
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
Commits
-
Disable WindowAgg inverse transitions when subplans are present
- 836c31ba508c 16.0 landed
- a9fa6d79aded 15.3 landed
- 4aa43ba21846 14.8 landed
- 301eb3ee4ecd 13.11 landed
- ac55abd33537 12.15 landed
- 8d2a8581b6d6 11.20 landed