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

From: Andres Freund <andres(at)anarazel(dot)de>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: xinwen(at)stu(dot)scu(dot)edu(dot)cn, pgsql-bugs(at)lists(dot)postgresql(dot)org, David Rowley <dgrowleyml(at)gmail(dot)com>
Subject: Re: BUG #17777: An assert failed in nodeWindowAgg.c
Date: 2023-02-11 01:51:12
Message-ID: 20230211015112.qwvmlnp5r4kyfffl@awork3.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Hi,

On 2023-02-10 20:08:09 -0500, Tom Lane wrote:
> Andres Freund <andres(at)anarazel(dot)de> writes:
> > I think we could just add a !contain_subplans() to the code deciding whether
> > it's safe to use the movable window optimization?
>
> Yeah, perhaps. That doesn't seem like a mainstream use-case either.

I suspect we ought to backpatch a fix and compared to some other ideas, that
seems not terribly invasive.

> Another idea, tying into your previous point, is to try to check
> contain_volatile_functions in the planner before we've reduced
> sublinks to subplans. I'm not sure that would be convenient to do
> though; subplan-conversion happens pretty early.

Yea, that doesn't seem too promising.

What I was referencing is that we already moved most aggregate processing to
the planner, c.f. preprocess_aggref(), but we didn't do the same for window
functions. Even though there's a lot of similar code there.

To fix the bug, we could just do a minimal version of that, I think, and add a
new field to WindowFunc, that we populate somewhere around
optimize_window_clauses().

Perhaps we ought to add something similar to parallel_safe to SubPlan?

> (I'm quite hesitant to move the goalposts on what
> contain_volatile_functions detects. As that comment indicates,
> some thought has gone into its current behavior, and I think
> we might hit some unwanted side-effects if we change it.)

Agreed. We could have a second "interface" function, using the same caller
though. But afaics, without adding information to the SubPlan nodes, we can't
really do better anyway?

Greetings,

Andres Freund

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Heikki Linnakangas 2023-02-11 10:58:02 Re: BUG #17760: SCRAM authentication fails with "modern" (rsassaPss signature) server certificate
Previous Message Tom Lane 2023-02-11 01:08:09 Re: BUG #17777: An assert failed in nodeWindowAgg.c