Re: BUG #17088: FailedAssertion in prepagg.c

Поиск
Список
Период
Сортировка
От Richard Guo
Тема Re: BUG #17088: FailedAssertion in prepagg.c
Дата
Msg-id CAMbWs4_zpvPa1+qGBU78FhQqiQo_RNDK2vwP3uBxs-S-mABxJQ@mail.gmail.com
обсуждение исходный текст
Ответ на Re: BUG #17088: FailedAssertion in prepagg.c  (Richard Guo <guofenglinux@gmail.com>)
Ответы Re: BUG #17088: FailedAssertion in prepagg.c  (Kyotaro Horiguchi <horikyota.ntt@gmail.com>)
Список pgsql-bugs

On Thu, Jul 8, 2021 at 2:14 PM Richard Guo <guofenglinux@gmail.com> wrote:

On Thu, Jul 8, 2021 at 1:44 PM Richard Guo <guofenglinux@gmail.com> wrote:

I think the culprit is that when replacing correlation uplevel vars with
Params, we do not handle the SubLinks in the arguments of uplevel
GroupingFunc. We expect build_subplan should take care of it. But in
build_subplan, we ignore GroupingFunc incorrectly.

diff --git a/src/backend/optimizer/plan/subselect.c b/src/backend/optimizer/plan/subselect.c
index 0881a208ac..e4918f275e 100644
--- a/src/backend/optimizer/plan/subselect.c
+++ b/src/backend/optimizer/plan/subselect.c
@@ -364,7 +364,8 @@ build_subplan(PlannerInfo *root, Plan *plan, PlannerInfo *subroot,
                 * SS_replace_correlation_vars).  Do that now.
                 */
                if (IsA(arg, PlaceHolderVar) ||
-                       IsA(arg, Aggref))
+                       IsA(arg, Aggref) ||
+                       IsA(arg, GroupingFunc))
                        arg = SS_process_sublinks(root, arg, false);



I think we also need to change SS_process_sublinks to avoid recursing
into the arguments of an outer GroupingFunc. And that leads to a fix as
attached.

Update the patch with comments and test cases.

Thanks
Richard
Вложения

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

Предыдущее
От: PG Bug reporting form
Дата:
Сообщение: BUG #17096: Cannot reinstall after uninstalling PostgreSQL on Windows 10 Pro for Workstations
Следующее
От: Richard Guo
Дата:
Сообщение: Re: BUG #17094: FailedAssertion at planner.c