model-writtenrun 9061 - may be wrong, links go to the source messages. Commit-by-commit LLM analysis is in the Commits dialog.
- Justin Pryzby reported that timing out REINDEX CONCURRENTLY could produce already-held-lock errors and leave subsequent table operations blocked in #1; Michael Paquier reproduced an assertion failure indicating unreleased locks in #2.
- Michael traced the problem to session-level lock cleanup in #4 and initially suspected a broader issue affecting commands that hold session locks between transactions, announcing a separate investigation in #5.
- After comparing CREATE INDEX CONCURRENTLY and VACUUM, Michael narrowed this fix to misplaced interrupt checks in REINDEX CONCURRENTLY and posted #6, moving the phase 2 and phase 3 checks inside transactions so abort processing releases session locks and avoids spurious warnings.
- Justin confirmed that the attached fix resolved the lock problem in #7.
- Michael committed #6 as 8270a0d9a9 with only comment reflow and backpatched it to PostgreSQL 12; in #8, he reported manually checking interruption cleanup for plain indexes and left the separate partitioned-index problems for another thread.