postgresql/src/include/executor
Tom Lane 4d20bad5e9 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
..
execdebug.h Implement Incremental Sort 2020-04-06 21:35:10 +02: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:11 -05:00
execParallel.h Add infrastructure to track WAL usage. 2020-04-04 10:02:08 +05:30
execPartition.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
executor.h Fix mishandling of resjunk columns in ON CONFLICT ... UPDATE tlists. 2021-05-10 11:02:29 -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:38:59 +13:00
instrument.h Change the display of WAL usage statistics in Explain. 2020-05-05 08:00:53 +05:30
nodeAgg.h HashAgg: use better cardinality estimate for recursive spilling. 2020-07-28 23:17:23 -07:00
nodeAppend.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
nodeBitmapAnd.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
nodeBitmapHeapscan.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
nodeBitmapIndexscan.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
nodeBitmapOr.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
nodeCtescan.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
nodeCustom.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
nodeForeignscan.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
nodeFunctionscan.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
nodeGather.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
nodeGatherMerge.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
nodeGroup.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
nodeHash.h Add hash_mem_multiplier GUC. 2020-07-29 14:14:57 -07:00
nodeHashjoin.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
nodeIncrementalSort.h Implement Incremental Sort 2020-04-06 21:35:10 +02:00
nodeIndexonlyscan.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
nodeIndexscan.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
nodeLimit.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
nodeLockRows.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
nodeMaterial.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
nodeMergeAppend.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
nodeMergejoin.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
nodeModifyTable.h Make new GENERATED-expressions code more bulletproof. 2023-01-15 14:06:46 -05:00
nodeNamedtuplestorescan.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
nodeNestloop.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
nodeProjectSet.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
nodeRecursiveunion.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
nodeResult.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
nodeSamplescan.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
nodeSeqscan.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
nodeSetOp.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
nodeSort.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
nodeSubplan.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
nodeSubqueryscan.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
nodeTableFuncscan.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
nodeTidscan.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
nodeUnique.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
nodeValuesscan.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
nodeWindowAgg.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
nodeWorktablescan.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
spi.h Re-add SPICleanup for ABI compatibility in stable branch 2022-07-18 19:20:07 +02:00
spi_priv.h Restore the portal-level snapshot after procedure COMMIT/ROLLBACK. 2021-05-21 14:03:53 -04:00
tablefunc.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
tqueue.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
tstoreReceiver.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
tuptable.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00