Re: BUG #17777: An assert failed in nodeWindowAgg.c

Andres Freund <andres@anarazel.de>

From: Andres Freund <andres@anarazel.de>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: xinwen@stu.scu.edu.cn, pgsql-bugs@lists.postgresql.org, David Rowley <dgrowleyml@gmail.com>
Date: 2023-02-11T00:49:40Z
Lists: pgsql-bugs
Hi,

On 2023-02-10 18:57:10 -0500, Tom Lane wrote:
> I might be more excited about it if there were a visible use-case
> for volatile filter expressions, but I can't see one.  The presented
> test case is obviously just a fuzzer, not a useful query.

I don't care about the performance of such a query, but it doesn't seem great
that the defense that we do have, doesn't work.  It's not like we don't have a
fallback execution path, it's just that we don't know that we have to use it.


Do you think all other uses of contain_volatile_functions() (and it looks like
contain_mutable_functions()) are fine with not detecting volatility in
subplans?


I don't think it's common, but I don't think it's crazy to have a volatile
function somewhere within an aggregate.  pg_current_wal_lsn(),
clock_timestamp(), pg_relation_size() or such.


I think we could just add a !contain_subplans() to the code deciding whether
it's safe to use the movable window optimization?

Greetings,

Andres Freund



Commits

  1. Disable WindowAgg inverse transitions when subplans are present