Re: BUG #17606: There is still some glitch in 3f7323cbb fixing failure of MULTIEXPR_SUBLINK
От | Richard Guo |
---|---|
Тема | Re: BUG #17606: There is still some glitch in 3f7323cbb fixing failure of MULTIEXPR_SUBLINK |
Дата | |
Msg-id | CAMbWs48Qf=2ZL-d-0=9rYBZUPsp6FdLysuYULTtEvErwi3w3jg@mail.gmail.com обсуждение исходный текст |
Ответ на | Re: BUG #17606: There is still some glitch in 3f7323cbb fixing failure of MULTIEXPR_SUBLINK (Richard Guo <guofenglinux@gmail.com>) |
Ответы |
Re: BUG #17606: There is still some glitch in 3f7323cbb fixing failure of MULTIEXPR_SUBLINK
|
Список | pgsql-bugs |
On Mon, Sep 5, 2022 at 10:25 PM Richard Guo <guofenglinux@gmail.com> wrote:
On Mon, Sep 5, 2022 at 3:33 PM PG Bug reporting form <noreply@postgresql.org> wrote:3f7323cbb regenerates its Param for each SubPlan by traversing the
targetlist. But ignore one point: initplan is not in targetlist.
This will result in a failed assertion, or an error like "unexpected
PARAM_MULTIEXPR ID: 131074"Since initplan SubPlans do not have args lists, I think it's OK for them
to share output parameters. So maybe we do not need to do the
SS_make_multiexprs_unique trick for initplan SubPlans?
If I consider it correctly, can we fix the initplan SubPlan issue simply
as below?
--- a/src/backend/optimizer/plan/subselect.c
+++ b/src/backend/optimizer/plan/subselect.c
@@ -911,6 +911,13 @@ SS_make_multiexprs_unique(PlannerInfo *root, PlannerInfo *subroot)
new_multiexpr_params = lappend(new_multiexpr_params, params);
}
+ /*
+ * It's OK for initplan SubPlans to share output parameters, so we do not
+ * need to generate new Param nodes for them.
+ */
+ if (new_multiexpr_params == NIL)
+ return;
+
/*
* Now we must find the Param nodes that reference the MULTIEXPR outputs
* and update their sublink IDs so they'll reference the new outputs.
Thanks
Richard
as below?
--- a/src/backend/optimizer/plan/subselect.c
+++ b/src/backend/optimizer/plan/subselect.c
@@ -911,6 +911,13 @@ SS_make_multiexprs_unique(PlannerInfo *root, PlannerInfo *subroot)
new_multiexpr_params = lappend(new_multiexpr_params, params);
}
+ /*
+ * It's OK for initplan SubPlans to share output parameters, so we do not
+ * need to generate new Param nodes for them.
+ */
+ if (new_multiexpr_params == NIL)
+ return;
+
/*
* Now we must find the Param nodes that reference the MULTIEXPR outputs
* and update their sublink IDs so they'll reference the new outputs.
Thanks
Richard
В списке pgsql-bugs по дате отправления: