Skip to content

Commit 92f8718

Browse 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 17fb603 commit 92f8718

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/backend/executor/nodeSubplan.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -797,7 +797,15 @@ ExecInitSubPlan(SubPlan *subplan, PlanState *parent)
797797
sstate->planstate = (PlanState *) list_nth(estate->es_subplanstates,
798798
subplan->plan_id - 1);
799799

800-
/* ... and to its parent's state */
800+
/*
801+
* This check can fail if the planner mistakenly puts a parallel-unsafe
802+
* subplan into a parallelized subquery; see ExecSerializePlan.
803+
*/
804+
if (sstate->planstate == NULL)
805+
elog(ERROR, "subplan \"%s\" was not initialized",
806+
subplan->plan_name);
807+
808+
/* Link to parent's state, too */
801809
sstate->parent = parent;
802810

803811
/* Initialize subexpressions */

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy