postgresql/src/include/executor
Tom Lane 1c2cb2744b Fix run-time partition pruning for appends with multiple source rels.
The previous coding here supposed that if run-time partitioning applied to
a particular Append/MergeAppend plan, then all child plans of that node
must be members of a single partitioning hierarchy.  This is totally wrong,
since an Append could be formed from a UNION ALL: we could have multiple
hierarchies sharing the same Append, or child plans that aren't part of any
hierarchy.

To fix, restructure the related plan-time and execution-time data
structures so that we can have a separate list or array for each
partitioning hierarchy.  Also track subplans that are not part of any
hierarchy, and make sure they don't get pruned.

Per reports from Phil Florent and others.  Back-patch to v11, since
the bug originated there.

David Rowley, with a lot of cosmetic adjustments by me; thanks also
to Amit Langote for review.

Discussion: https://postgr.es/m/HE1PR03MB17068BB27404C90B5B788BCABA7B0@HE1PR03MB1706.eurprd03.prod.outlook.com
2018-08-01 19:42:52 -04:00
..
execExpr.h Post-feature-freeze pgindent run. 2018-04-26 14:47:16 -04:00
execParallel.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
execPartition.h Fix run-time partition pruning for appends with multiple source rels. 2018-08-01 19:42:52 -04:00
execdebug.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
execdesc.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
executor.h Don't needlessly check the partition contraint twice 2018-06-11 17:12:16 -04:00
functions.h Support INOUT arguments in procedures 2018-03-14 12:07:28 -04:00
hashjoin.h Fix a boatload of typos in C comments. 2018-04-01 15:01:28 -04:00
instrument.h Post-feature-freeze pgindent run. 2018-04-26 14:47:16 -04:00
nodeAgg.h Improve spelling of new FINALFUNC_MODIFY aggregate attribute. 2018-05-21 11:41:42 -04:00
nodeAppend.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
nodeBitmapAnd.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
nodeBitmapHeapscan.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
nodeBitmapIndexscan.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
nodeBitmapOr.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
nodeCtescan.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
nodeCustom.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
nodeForeignscan.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
nodeFunctionscan.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
nodeGather.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
nodeGatherMerge.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
nodeGroup.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
nodeHash.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
nodeHashjoin.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
nodeIndexonlyscan.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
nodeIndexscan.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
nodeLimit.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
nodeLockRows.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
nodeMaterial.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
nodeMergeAppend.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
nodeMergejoin.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
nodeModifyTable.h Revert MERGE patch 2018-04-12 11:22:56 +01:00
nodeNamedtuplestorescan.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
nodeNestloop.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
nodeProjectSet.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
nodeRecursiveunion.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
nodeResult.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
nodeSamplescan.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
nodeSeqscan.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
nodeSetOp.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
nodeSort.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
nodeSubplan.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
nodeSubqueryscan.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
nodeTableFuncscan.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
nodeTidscan.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
nodeUnique.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
nodeValuesscan.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
nodeWindowAgg.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
nodeWorktablescan.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
spi.h Fix SPI error cleanup and memory leak 2018-05-03 08:39:15 -04:00
spi_priv.h Post-feature-freeze pgindent run. 2018-04-26 14:47:16 -04:00
tablefunc.h Fix a boatload of typos in C comments. 2018-04-01 15:01:28 -04:00
tqueue.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
tstoreReceiver.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
tuptable.h Post-feature-freeze pgindent run. 2018-04-26 14:47:16 -04:00