model-writtenrun 9554 - may be wrong, links go to the source messages. Commit-by-commit LLM analysis is in the Commits dialog.
- Tom Lane reported that generic prepared DELETE plans could open indexes without locks because scan nodes assumed ModifyTable had locked them, while ModifyTable deliberately skipped opening indexes for DELETE #1.
- David Rowley favored removing the target-relation check because it also scaled poorly for partitioned updates, but Tom demonstrated a CTE lock-upgrade hazard and David proposed planner-side consolidation of lock strengths #2 #3 #4.
- Amit Langote supplied an OID-based target-relation comparison and supported earlier index locking, but David opposed moving work into InitPlan because it could undermine future runtime partition pruning; Amit's patch was not carried forward #5 #6.
- David introduced an independent prototype with RangeTblEntry.idxlockmode and finalize_lockmodes, then returned after a two-month gap to add bitmap-index-scan support and cleanup while acknowledging that parser lock-upgrade hazards remained #10 #12.
- Julien Rouhaud found that using the outer statement's command type assigned insufficient index locks to modifying CTEs; David subsequently moved index-lock determination before inheritance expansion and consolidated both table and index lock strengths afterward #13 #15 #17.
- The expanded patch prompted questions about DELETE behavior and future storage engines, while Amit proposed using rellockmode directly and David explained that fully preventing lock upgrades would require impractical changes across parsing and planning #17 #20 #23.
- Tom settled the design by dropping lock-upgrade prevention and the separate index-lock field, directing the patch to reuse rellockmode and retain ExecRelationIsTargetRelation only for potential FDW callers; David implemented that simplification and extended the planner locking cleanup #24 #25.
- Amit's review led to using NoLock where selfuncs.c could rely on existing planner locks and using rellockmode consistently in infer_arbiter_indexes; David's first updated attachment omitted the intended selfuncs.c changes, so he immediately supplied the corrected version #26 #28 #29 #30.
- Tom committed #30 as 9c703c169a, revising comments, removing an unnecessary assertion, and additionally changing gin_clean_pending_list to use RowExclusiveLock; he left possible index-DDL locking cleanup open #31.
- The query index-locking fix was landed, with the broader lock-upgrade work abandoned, when Andres Freund later reopened discussion of local-lock-table design and a NOWAIT inconsistency in LockAcquireExtended; no follow-up patch or resolution appears in the thread #33.