Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 13 additions & 3 deletions src/backend/commands/explain.c
Original file line number Diff line number Diff line change
Expand Up @@ -1540,7 +1540,7 @@ ExplainNode(PlanState *planstate, List *ancestors,
const char *relationship, const char *plan_name,
ExplainState *es)
{
Plan *plan = planstate->plan;
Plan *plan;
PlanState *parentplanstate;
ExecSlice *save_currentSlice = es->currentSlice; /* save */
const char *pname; /* node type name for text output */
Expand All @@ -1557,6 +1557,13 @@ ExplainNode(PlanState *planstate, List *ancestors,
int motion_recv;
int motion_snd;
ExecSlice *parentSlice = NULL;
/*
* Guard against the case where a subtree on the QE lives in another slice
* and is not instantiated in this slice.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment doesn't say where the decision not to instantiate the subtree is made, so a reader has no starting point. I think you should add a pointer to ExecInitMotion here:

/*
 * Guard against the case where a subtree on the QE lives in another slice
 * and is not instantiated in this slice (see ExecInitMotion).
 */

*/
if (planstate == NULL)
return;
plan = planstate->plan;

/* Remember who called us. */
parentplanstate = es->parentPlanState;
Expand Down Expand Up @@ -2945,8 +2952,11 @@ ExplainNode(PlanState *planstate, List *ancestors,
/* lefttree */
if (outerPlan(plan) && !skip_outer)
{
ExplainNode(outerPlanState(planstate), ancestors,
"Outer", NULL, es);
if (outerPlanState(planstate))
{
ExplainNode(outerPlanState(planstate), ancestors,
"Outer", NULL, es);
}
}
else if (skip_outer)
{
Expand Down
Loading