model-writtenrun 5593 - may be wrong, links go to the source messages. Commit-by-commit LLM analysis is in the Commits dialog.
- Daniil Anisimov reported that concurrent pgbench activity produced a Valgrind invalid-read warning in heapam_tuple_lock(); Tom Lane reproduced it and traced the underlying problem to removal of heap_fetch()'s keep_buf argument, leaving tuple accesses after the buffer pin was released #1 #2 #3.
- Peter Geoghegan identified concurrent pruning and page defragmentation as a more plausible danger than buffer replacement, prompting Tom Lane to conclude that stable branches also needed a fix because the race could silently skip an update #4 #5 #6.
- Andres Freund proposed fetching with SnapshotAny and checking visibility separately; Tom Lane instead wanted an interface that could not return an unpinned tuple pointer, and Andres confirmed that clearing the pointer exposed the bug through isolation-test failures #7 #8 #9.
- The discussion explored storing the next tuple identifier in SnapshotData, including reusing storage to avoid a stable-branch ABI break, but Tom Lane abandoned that approach because callers also needed a potentially expensive update-transaction lookup; his first patch restored optional buffer-pin retention through heap_fetch_extended() #9 #10 #11 #12 #13 #14.
- Tom Lane then separated the development and stable-branch implementations: HEAD restored the keep_buf argument directly on heap_fetch() and cleared unpinned tuple pointers, while stable branches used heap_fetch_extended() and preserved existing heap_fetch() behavior to avoid breaking valid callers #15.
- The thread ends with those two variants posted and no subsequent test or review responses; the supplied commit records show that the HEAD variant landed unchanged as 7b7ed046cb, with the fix also backpatched through PostgreSQL 12 #15.