diff options
author | Robert Haas <rhaas@postgresql.org> | 2017-10-27 16:04:01 +0200 |
---|---|---|
committer | Robert Haas <rhaas@postgresql.org> | 2017-10-27 16:04:01 +0200 |
commit | 639c1a6bb9ee08fe4757a6fab1ddbd01291515e1 (patch) | |
tree | 67f3bce3cad068c18ecb4132fa1ac04d150a9f41 /src/backend/executor/nodeGatherMerge.c | |
parent | 820c0305f64507490f00b6220f9175a303c821dd (diff) | |
download | postgresql-639c1a6bb9ee08fe4757a6fab1ddbd01291515e1.tar.gz postgresql-639c1a6bb9ee08fe4757a6fab1ddbd01291515e1.zip |
Fix mistaken failure to allow parallelism in corner case.
If we try to run a parallel plan in serial mode because, for example,
it's going to be scanned via a cursor, but for some reason we're
already in parallel mode (for example because an outer query is
running in parallel), we'd incorrectly try to launch workers.
Fix by adding a flag to the EState, so that we can be certain that
ExecutePlan() and ExecGather()/ExecGatherMerge() will have the same
idea about whether we are executing serially or in parallel.
Report and fix by Amit Kapila with help from Kuntal Ghosh. A few
tweaks by me.
Discussion: http://postgr.es/m/CAA4eK1+_BuZrmVCeua5Eqnm4Co9DAXdM5HPAOE2J19ePbR912Q@mail.gmail.com
Diffstat (limited to 'src/backend/executor/nodeGatherMerge.c')
-rw-r--r-- | src/backend/executor/nodeGatherMerge.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/backend/executor/nodeGatherMerge.c b/src/backend/executor/nodeGatherMerge.c index 70f33a9a28f..5625b125210 100644 --- a/src/backend/executor/nodeGatherMerge.c +++ b/src/backend/executor/nodeGatherMerge.c @@ -194,7 +194,7 @@ ExecGatherMerge(PlanState *pstate) * Sometimes we might have to run without parallelism; but if parallel * mode is active then we can try to fire up some workers. */ - if (gm->num_workers > 0 && IsInParallelMode()) + if (gm->num_workers > 0 && estate->es_use_parallel_mode) { ParallelContext *pcxt; |