diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2017-04-18 15:43:56 -0400 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2017-04-18 15:43:56 -0400 |
commit | 39151781c8cd2c8bf6057496426fb9c07178eda5 (patch) | |
tree | 1229dc6473aa346efac09aee94a8ee525ea0e191 /src/include/nodes/primnodes.h | |
parent | 539f67012ec978e931054e413a4ab3c4c68bb737 (diff) | |
download | postgresql-39151781c8cd2c8bf6057496426fb9c07178eda5.tar.gz |
Fix testing of parallel-safety of SubPlans.
is_parallel_safe() supposed that the only relevant property of a SubPlan
was the parallel safety of the referenced subplan tree. This is wrong:
the testexpr or args subtrees might contain parallel-unsafe stuff, as
demonstrated by the test case added here. However, just recursing into the
subtrees fails in a different way: we'll typically find PARAM_EXEC Params
representing the subplan's output columns in the testexpr. The previous
coding supposed that any Param must be treated as parallel-restricted, so
that a naive attempt at fixing this disabled parallel pushdown of SubPlans
altogether. We must instead determine, for any visited Param, whether it
is one that would be computed by a surrounding SubPlan node; if so, it's
safe to push down along with the SubPlan node.
We might later be able to extend this logic to cope with Params used for
correlated subplans and other cases; but that's a task for v11 or beyond.
Tom Lane and Amit Kapila
Discussion: https://postgr.es/m/7064.1492022469@sss.pgh.pa.us
Diffstat (limited to 'src/include/nodes/primnodes.h')
-rw-r--r-- | src/include/nodes/primnodes.h | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/include/nodes/primnodes.h b/src/include/nodes/primnodes.h index b87fe84545..86ec82eaaa 100644 --- a/src/include/nodes/primnodes.h +++ b/src/include/nodes/primnodes.h @@ -699,7 +699,8 @@ typedef struct SubPlan bool unknownEqFalse; /* TRUE if it's okay to return FALSE when the * spec result is UNKNOWN; this allows much * simpler handling of null values */ - bool parallel_safe; /* OK to use as part of parallel plan? */ + bool parallel_safe; /* is the subplan parallel-safe? */ + /* Note: parallel_safe does not consider contents of testexpr or args */ /* Information for passing params into and out of the subselect: */ /* setParam and parParam are lists of integers (param IDs) */ List *setParam; /* initplan subqueries have to set these |