Revert "Don't lock partitions pruned by initial pruning"
As pointed out by Tom Lane, the patch introduced fragile and invasive
design around plan invalidation handling when locking of prunable
partitions was deferred from plancache.c to the executor. In
particular, it violated assumptions about CachedPlan immutability and
altered executor APIs in ways that are difficult to justify given the
added complexity and overhead.
This also removes the firstResultRels field added to PlannedStmt in
commit 28317de72, which was intended to support deferred locking of
certain ModifyTable result relations.
Reported-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/605328.1747710381@sss.pgh.pa.us
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/1722d5eb05d8e5d2e064cd1798abcae4f296ca9d
Modified Files
--------------
contrib/auto_explain/auto_explain.c | 16 +-
contrib/pg_stat_statements/pg_stat_statements.c | 16 +-
doc/src/sgml/release-18.sgml | 21 ---
src/backend/commands/copyto.c | 5 +-
src/backend/commands/createas.c | 5 +-
src/backend/commands/explain.c | 22 +--
src/backend/commands/extension.c | 4 +-
src/backend/commands/matview.c | 5 +-
src/backend/commands/portalcmds.c | 1 -
src/backend/commands/prepare.c | 9 +-
src/backend/commands/trigger.c | 15 --
src/backend/executor/README | 35 +----
src/backend/executor/execMain.c | 127 ++-------------
src/backend/executor/execParallel.c | 12 +-
src/backend/executor/execPartition.c | 66 +-------
src/backend/executor/execUtils.c | 1 -
src/backend/executor/functions.c | 5 +-
src/backend/executor/spi.c | 29 +---
src/backend/optimizer/plan/planner.c | 2 -
src/backend/optimizer/plan/setrefs.c | 3 -
src/backend/tcop/postgres.c | 4 +-
src/backend/tcop/pquery.c | 51 +-----
src/backend/utils/cache/plancache.c | 197 +++---------------------
src/backend/utils/mmgr/portalmem.c | 4 +-
src/include/commands/explain.h | 6 +-
src/include/commands/trigger.h | 1 -
src/include/executor/execdesc.h | 2 -
src/include/executor/executor.h | 34 +---
src/include/nodes/execnodes.h | 3 -
src/include/nodes/pathnodes.h | 3 -
src/include/nodes/plannodes.h | 7 -
src/include/utils/plancache.h | 46 +-----
src/include/utils/portal.h | 4 +-
33 files changed, 89 insertions(+), 672 deletions(-)