postgresql/src/include/executor
Tom Lane 4089b9bd6f Simplify executor's determination of whether to use parallelism.
Our parallel-mode code only works when we are executing a query
in full, so ExecutePlan must disable parallel mode when it is
asked to do partial execution.  The previous logic for this
involved passing down a flag (variously named execute_once or
run_once) from callers of ExecutorRun or PortalRun.  This is
overcomplicated, and unsurprisingly some of the callers didn't
get it right, since it requires keeping state that not all of
them have handy; not to mention that the requirements for it were
undocumented.  That led to assertion failures in some corner
cases.  The only state we really need for this is the existing
QueryDesc.already_executed flag, so let's just put all the
responsibility in ExecutePlan.  (It could have been done in
ExecutorRun too, leading to a slightly shorter patch -- but if
there's ever more than one caller of ExecutePlan, it seems better
to have this logic in the subroutine than the callers.)

This makes those ExecutorRun/PortalRun parameters unnecessary.
In master it seems okay to just remove them, returning the
API for those functions to what it was before parallelism.
Such an API break is clearly not okay in stable branches,
but for them we can just leave the parameters in place after
documenting that they do nothing.

Per report from Yugo Nagata, who also reviewed and tested
this patch.  Back-patch to all supported branches.

Discussion: https://postgr.es/m/20241206062549.710dc01cf91224809dd6c0e1@sraoss.co.jp
2024-12-09 14:38:19 -05:00
..
execAsync.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
execdebug.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
execdesc.h Simplify executor's determination of whether to use parallelism. 2024-12-09 14:38:19 -05:00
execExpr.h Fix NULLIF()'s handling of read-write expanded objects. 2024-11-25 18:09:10 -05:00
execParallel.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
execPartition.h Revert "Rewrite some RI code to avoid using SPI" 2022-04-07 23:42:13 +02:00
executor.h Fix misbehavior of EvalPlanQual checks with multiple result relations. 2023-05-19 14:26:34 -04:00
functions.h Fix confusion about the return rowtype of SQL-language procedures. 2024-03-12 18:16:10 -04:00
hashjoin.h Fix race in parallel hash join batch cleanup, take II. 2023-03-21 14:32:14 +13:00
instrument.h Track I/O timing for temporary file blocks in EXPLAIN (BUFFERS) 2022-04-08 11:27:21 +09:00
nodeAgg.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
nodeAppend.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
nodeBitmapAnd.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
nodeBitmapHeapscan.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
nodeBitmapIndexscan.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
nodeBitmapOr.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
nodeCtescan.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
nodeCustom.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
nodeForeignscan.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
nodeFunctionscan.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
nodeGather.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
nodeGatherMerge.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
nodeGroup.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
nodeHash.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
nodeHashjoin.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
nodeIncrementalSort.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
nodeIndexonlyscan.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
nodeIndexscan.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
nodeLimit.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
nodeLockRows.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
nodeMaterial.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
nodeMemoize.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
nodeMergeAppend.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
nodeMergejoin.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
nodeModifyTable.h Make new GENERATED-expressions code more bulletproof. 2023-01-15 14:06:46 -05:00
nodeNamedtuplestorescan.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
nodeNestloop.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
nodeProjectSet.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
nodeRecursiveunion.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
nodeResult.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
nodeSamplescan.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
nodeSeqscan.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
nodeSetOp.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
nodeSort.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
nodeSubplan.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
nodeSubqueryscan.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
nodeTableFuncscan.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
nodeTidrangescan.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
nodeTidscan.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
nodeUnique.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
nodeValuesscan.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
nodeWindowAgg.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
nodeWorktablescan.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
spi.h Add support for MERGE SQL command 2022-03-28 16:47:48 +02:00
spi_priv.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
tablefunc.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
tqueue.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
tstoreReceiver.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
tuptable.h Update copyright for 2022 2022-01-07 19:04:57 -05:00