Revert "Don't lock partitions pruned by initial pruning"
authorAmit Langote <[email protected]>
Thu, 22 May 2025 05:17:24 +0000 (14:17 +0900)
committerAmit Langote <[email protected]>
Thu, 22 May 2025 08:02:35 +0000 (17:02 +0900)
commit1722d5eb05d8e5d2e064cd1798abcae4f296ca9d
tree6661dfcd476b8e355f4f05d38badbe1c6de2ed36
parentf3622b64762bb5ee5242937f0fadcacb1a10f30e
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 <[email protected]>
Discussion: https://postgr.es/m/605328.1747710381@sss.pgh.pa.us
33 files changed:
contrib/auto_explain/auto_explain.c
contrib/pg_stat_statements/pg_stat_statements.c
doc/src/sgml/release-18.sgml
src/backend/commands/copyto.c
src/backend/commands/createas.c
src/backend/commands/explain.c
src/backend/commands/extension.c
src/backend/commands/matview.c
src/backend/commands/portalcmds.c
src/backend/commands/prepare.c
src/backend/commands/trigger.c
src/backend/executor/README
src/backend/executor/execMain.c
src/backend/executor/execParallel.c
src/backend/executor/execPartition.c
src/backend/executor/execUtils.c
src/backend/executor/functions.c
src/backend/executor/spi.c
src/backend/optimizer/plan/planner.c
src/backend/optimizer/plan/setrefs.c
src/backend/tcop/postgres.c
src/backend/tcop/pquery.c
src/backend/utils/cache/plancache.c
src/backend/utils/mmgr/portalmem.c
src/include/commands/explain.h
src/include/commands/trigger.h
src/include/executor/execdesc.h
src/include/executor/executor.h
src/include/nodes/execnodes.h
src/include/nodes/pathnodes.h
src/include/nodes/plannodes.h
src/include/utils/plancache.h
src/include/utils/portal.h