Amit Kapila <amit.kapila16@gmail.com> writes:
> On Mon, Nov 21, 2016 at 6:10 PM, Amit Kapila <amit.kapila16@gmail.com> wrote:
>> Here instead of checking whether top_plan has initPlan, it should
>> check whether initPlan is present anywhere in plan tree. I think one
>> simple way could be to check *glob->subplans* instead of
>> top_plan->initPlan,
> Patch based on above suggestion is attached with this mail.
I think this is the right fix for the moment, because the proximate cause
of the crash is that ExecSerializePlan doesn't transmit any part of the
PlannedStmt.subplans list, which glob->subplans is the preimage of.
Now, maybe I'm missing something, but it seems to me that ordinary
subplans could be transmitted to workers just fine. The problem with
transmitting initplans is that you'd lose the expectation of single
evaluation. (Even there, it might be okay if they're far enough down
in the plan tree, but I haven't thought about it in detail.) So I'd
rather see us fix ExecSerializePlan to transmit the subplans list
and have some more-restrictive test here. This code would still be
wrong as it stands though.
regards, tom lane