postgresql/src/include/executor
Tom Lane 6630ccad7a Restructure creation of run-time pruning steps.
Previously, gen_partprune_steps() always built executor pruning steps
using all suitable clauses, including those containing PARAM_EXEC
Params.  This meant that the pruning steps were only completely safe
for executor run-time (scan start) pruning.  To prune at executor
startup, we had to ignore the steps involving exec Params.  But this
doesn't really work in general, since there may be logic changes
needed as well --- for example, pruning according to the last operator's
btree strategy is the wrong thing if we're not applying that operator.
The rules embodied in gen_partprune_steps() and its minions are
sufficiently complicated that tracking their incremental effects in
other logic seems quite impractical.

Short of a complete redesign, the only safe fix seems to be to run
gen_partprune_steps() twice, once to create executor startup pruning
steps and then again for run-time pruning steps.  We can save a few
cycles however by noting during the first scan whether we rejected
any clauses because they involved exec Params --- if not, we don't
need to do the second scan.

In support of this, refactor the internal APIs in partprune.c to make
more use of passing information in the GeneratePruningStepsContext
struct, rather than as separate arguments.

This is, I hope, the last piece of our response to a bug report from
Alan Jackson.  Back-patch to v11 where this code came in.

Discussion: https://postgr.es/m/FAD28A83-AC73-489E-A058-2681FA31D648@tvsquared.com
2019-05-17 19:44:34 -04:00
..
execExpr.h Renaming for new subscripting mechanism 2019-02-01 12:50:32 -03:00
execParallel.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
execPartition.h Restructure creation of run-time pruning steps. 2019-05-17 19:44:34 -04:00
execdebug.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
execdesc.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
executor.h tableam: Add tuple_{insert, delete, update, lock} and use. 2019-03-23 19:55:57 -07:00
functions.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
hashjoin.h Collations with nondeterministic comparison 2019-03-22 12:12:43 +01:00
instrument.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
nodeAgg.h Change function call information to be variable length. 2019-01-26 14:17:52 -08:00
nodeAppend.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
nodeBitmapAnd.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
nodeBitmapHeapscan.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
nodeBitmapIndexscan.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
nodeBitmapOr.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
nodeCtescan.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
nodeCustom.h Rename nodes/relation.h to nodes/pathnodes.h. 2019-01-29 16:49:25 -05:00
nodeForeignscan.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
nodeFunctionscan.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
nodeGather.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
nodeGatherMerge.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
nodeGroup.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
nodeHash.h Collations with nondeterministic comparison 2019-03-22 12:12:43 +01:00
nodeHashjoin.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
nodeIndexonlyscan.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
nodeIndexscan.h Don't include genam.h from execnodes.h and relscan.h anymore. 2019-01-14 17:02:12 -08:00
nodeLimit.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
nodeLockRows.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
nodeMaterial.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
nodeMergeAppend.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
nodeMergejoin.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
nodeModifyTable.h Generated columns 2019-03-30 08:15:57 +01:00
nodeNamedtuplestorescan.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
nodeNestloop.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
nodeProjectSet.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
nodeRecursiveunion.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
nodeResult.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
nodeSamplescan.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
nodeSeqscan.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
nodeSetOp.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
nodeSort.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
nodeSubplan.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
nodeSubqueryscan.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
nodeTableFuncscan.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
nodeTidscan.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
nodeUnique.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
nodeValuesscan.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
nodeWindowAgg.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
nodeWorktablescan.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
spi.h Transaction chaining 2019-03-24 11:33:02 +01:00
spi_priv.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
tablefunc.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
tqueue.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
tstoreReceiver.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
tuptable.h Fix two memory leaks around force-storing tuples in slots. 2019-04-19 11:39:56 -07:00