Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 9d878d7

Browse filesBrowse files
committed
Guard against core dump from uninitialized subplan.
If the planner erroneously puts a non-parallel-safe SubPlan into a parallelized portion of the query tree, nodeSubplan.c will fail in the worker processes because it finds a null in es_subplanstates, which it's unable to cope with. It seems worth a test-and-elog to make that an error case rather than a core dump case. This probably should have been included in commit 16ebab6, which was responsible for allowing nulls to appear in es_subplanstates to begin with. So, back-patch to v10 where that came in. Discussion: https://postgr.es/m/924226.1604422326@sss.pgh.pa.us
1 parent df4405b commit 9d878d7
Copy full SHA for 9d878d7

File tree

Expand file treeCollapse file tree

1 file changed

+9
-1
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+9
-1
lines changed
Open diff view settings
Collapse file

‎src/backend/executor/nodeSubplan.c‎

Copy file name to clipboardExpand all lines: src/backend/executor/nodeSubplan.c
+9-1Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -710,7 +710,15 @@ ExecInitSubPlan(SubPlan *subplan, PlanState *parent)
710710
sstate->planstate = (PlanState *) list_nth(estate->es_subplanstates,
711711
subplan->plan_id - 1);
712712

713-
/* ... and to its parent's state */
713+
/*
714+
* This check can fail if the planner mistakenly puts a parallel-unsafe
715+
* subplan into a parallelized subquery; see ExecSerializePlan.
716+
*/
717+
if (sstate->planstate == NULL)
718+
elog(ERROR, "subplan \"%s\" was not initialized",
719+
subplan->plan_name);
720+
721+
/* Link to parent's state, too */
714722
sstate->parent = parent;
715723

716724
/* Initialize subexpressions */

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.