Re: BUG #17709: Regression in PG15 with window functions - "WindowFunc not found in subplan target lists"

Поиск
Список
Период
Сортировка
От Richard Guo
Тема Re: BUG #17709: Regression in PG15 with window functions - "WindowFunc not found in subplan target lists"
Дата
Msg-id CAMbWs4-4L6Emr4e-npde9h5M56wUFt6GwrPykAM9GD+W9cDfTA@mail.gmail.com
обсуждение исходный текст
Ответ на Re: BUG #17709: Regression in PG15 with window functions - "WindowFunc not found in subplan target lists"  (David Rowley <dgrowleyml@gmail.com>)
Ответы Re: BUG #17709: Regression in PG15 with window functions - "WindowFunc not found in subplan target lists"
Список pgsql-bugs

On Fri, Dec 9, 2022 at 7:53 PM David Rowley <dgrowleyml@gmail.com> wrote:
The additional thing that seems to cause the reported error is that
once the subquery is pulled up, the run condition also needs a round
of constant folding done. See subquery_planner() around line 827.  The
problem is that the target list's WindowFunc ends up with count(1)
over .., but the run condition's one is left as count(case 1 when 1
then 1 else null end), which preprocess_expression() will fold into
the same as what's in the target list.
 
Yes exactly. That's what we also have to do.  I was debugging with a
simplified version of the query with the WindowFunc as count(t1.a) over
(...) and did not realize constant folding is also needed for the
runCondition.
 
I'm now wondering if WindowClause.runCondition should be of type Node
* instead of List *. I'd have imagined I should be passing the type of
EXPRKIND_QUAL to preprocess_expression's type, but canonicalize_qual()
does not like Lists.
 
I'm not sure about this.  From how the runCondition is constructed in
find_window_run_conditions, it seems there is no need to canonicalize
it.

Thanks
Richard

В списке pgsql-bugs по дате отправления:

Предыдущее
От: David Rowley
Дата:
Сообщение: Re: BUG #17709: Regression in PG15 with window functions - "WindowFunc not found in subplan target lists"
Следующее
От: Tom Lane
Дата:
Сообщение: Re: BUG #17708: 12.4