postgresql/src/include/executor
Tom Lane 8a95ad3b20 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 Initial pgindent and pgperltidy run for v14. 2021-05-12 13:14:10 -04:00
execdebug.h Update copyright for 2021 2021-01-02 13:06:25 -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 2021 2021-01-02 13:06:25 -05:00
execPartition.h Postpone some stuff out of ExecInitModifyTable. 2021-04-06 15:57:11 -04: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:37:33 +13:00
instrument.h Fix issues in pg_stat_wal. 2021-05-19 11:38:34 +09:00
nodeAgg.h Update copyright for 2021 2021-01-02 13:06:25 -05:00
nodeAppend.h Add support for asynchronous execution. 2021-03-31 18:45:00 +09:00
nodeBitmapAnd.h Update copyright for 2021 2021-01-02 13:06:25 -05:00
nodeBitmapHeapscan.h Update copyright for 2021 2021-01-02 13:06:25 -05:00
nodeBitmapIndexscan.h Update copyright for 2021 2021-01-02 13:06:25 -05:00
nodeBitmapOr.h Update copyright for 2021 2021-01-02 13:06:25 -05:00
nodeCtescan.h Update copyright for 2021 2021-01-02 13:06:25 -05:00
nodeCustom.h Update copyright for 2021 2021-01-02 13:06:25 -05:00
nodeForeignscan.h Add support for asynchronous execution. 2021-03-31 18:45:00 +09:00
nodeFunctionscan.h Update copyright for 2021 2021-01-02 13:06:25 -05:00
nodeGather.h Update copyright for 2021 2021-01-02 13:06:25 -05:00
nodeGatherMerge.h Update copyright for 2021 2021-01-02 13:06:25 -05:00
nodeGroup.h Update copyright for 2021 2021-01-02 13:06:25 -05:00
nodeHash.h Update copyright for 2021 2021-01-02 13:06:25 -05:00
nodeHashjoin.h Update copyright for 2021 2021-01-02 13:06:25 -05:00
nodeIncrementalSort.h Update copyright for 2021 2021-01-02 13:06:25 -05:00
nodeIndexonlyscan.h Update copyright for 2021 2021-01-02 13:06:25 -05:00
nodeIndexscan.h Update copyright for 2021 2021-01-02 13:06:25 -05:00
nodeLimit.h Update copyright for 2021 2021-01-02 13:06:25 -05:00
nodeLockRows.h Update copyright for 2021 2021-01-02 13:06:25 -05:00
nodeMaterial.h Update copyright for 2021 2021-01-02 13:06:25 -05:00
nodeMemoize.h Change the name of the Result Cache node to Memoize 2021-07-14 12:45:00 +12:00
nodeMergeAppend.h Update copyright for 2021 2021-01-02 13:06:25 -05:00
nodeMergejoin.h Update copyright for 2021 2021-01-02 13:06:25 -05:00
nodeModifyTable.h Make new GENERATED-expressions code more bulletproof. 2023-01-15 14:06:46 -05:00
nodeNamedtuplestorescan.h Update copyright for 2021 2021-01-02 13:06:25 -05:00
nodeNestloop.h Update copyright for 2021 2021-01-02 13:06:25 -05:00
nodeProjectSet.h Update copyright for 2021 2021-01-02 13:06:25 -05:00
nodeRecursiveunion.h Update copyright for 2021 2021-01-02 13:06:25 -05:00
nodeResult.h Update copyright for 2021 2021-01-02 13:06:25 -05:00
nodeSamplescan.h Update copyright for 2021 2021-01-02 13:06:25 -05:00
nodeSeqscan.h Update copyright for 2021 2021-01-02 13:06:25 -05:00
nodeSetOp.h Update copyright for 2021 2021-01-02 13:06:25 -05:00
nodeSort.h Update copyright for 2021 2021-01-02 13:06:25 -05:00
nodeSubplan.h Update copyright for 2021 2021-01-02 13:06:25 -05:00
nodeSubqueryscan.h Update copyright for 2021 2021-01-02 13:06:25 -05:00
nodeTableFuncscan.h Update copyright for 2021 2021-01-02 13:06:25 -05:00
nodeTidrangescan.h Add TID Range Scans to support efficient scanning ranges of TIDs 2021-02-27 22:59:36 +13:00
nodeTidscan.h Update copyright for 2021 2021-01-02 13:06:25 -05:00
nodeUnique.h Update copyright for 2021 2021-01-02 13:06:25 -05:00
nodeValuesscan.h Update copyright for 2021 2021-01-02 13:06:25 -05:00
nodeWindowAgg.h Update copyright for 2021 2021-01-02 13:06:25 -05:00
nodeWorktablescan.h Update copyright for 2021 2021-01-02 13:06:25 -05:00
spi.h Re-add SPICleanup for ABI compatibility in stable branch 2022-07-18 16:23:48 +02:00
spi_priv.h Improve performance of repeated CALLs within plpgsql procedures. 2021-01-25 22:28:29 -05:00
tablefunc.h Update copyright for 2021 2021-01-02 13:06:25 -05:00
tqueue.h Update copyright for 2021 2021-01-02 13:06:25 -05:00
tstoreReceiver.h Update copyright for 2021 2021-01-02 13:06:25 -05:00
tuptable.h Update copyright for 2021 2021-01-02 13:06:25 -05:00