model-writtenrun 3695 - may be wrong, links go to the source messages. Commit-by-commit LLM analysis is in the Commits dialog.
- Alexander Lakhin reported invalid memory accesses during concurrent updates with BEFORE ROW UPDATE triggers, tracing them to newslot referencing data in a buffer whose last pin was released when oldslot was materialized #1.
- Alexander proposed materializing newslot first in #2 and supplied a separate isolation-test reproducer in #3; Richard Guo reproduced the failure, agreed with the fix, and requested an explanatory comment that Alexander incorporated in #6 #4 #5.
- Alexander left the isolation test out of the fix because a dedicated test seemed disproportionate and he had not found a suitable existing test to extend #6.
- Tom Lane questioned whether the fix covered other execution paths and whether buffer-pin ownership should be fixed more generally, prompting further investigation rather than immediate commitment #8 #9.
- Peter Geoghegan explained Valgrind's ability to detect unpinned-buffer accesses, while Andres Freund explained why slot machinery does not automatically protect every referenced storage lifetime; Alexander distinguished the Valgrind warning from the corruption previously detected by ASAN #10 #11 #12.
- Alexander traced the difference between the older EPQ output and the newer projection using oldslot, then broadened the patch to materialize without an EPQ condition and remove both the allegedly unreachable copy and a later materialization safeguard #15 #16.
- After the patch was queued for commitfest attention, Robert Haas resumed substantive review in January, requesting a commit message and questioning how two slots could reference a buffer with only one pin; Alexander added the explanation in #20 #17 #18 #19.
- Alexander supplied diagnostic instrumentation showing distinct slots sharing attribute pointers while only oldslot held a buffer pin; Robert then understood the failure and supported committing the fix with clearer comments #22 #23 #24 #25.
- Tom and Robert briefly favored unconditional materialization for simpler lifetime guarantees, while Alexander checked other callers and explained that the non-EPQ path did not depend on the locally created oldslot #26 #27 #29 #30 #31.
- Tom's final analysis established that the hazard requires an updated tuple on a different page and that trigger invocation already materializes both slots, so his revised patch restricted the new materialization to EPQ, retained copying into the caller's slot, and preserved the later safeguard against a distinct dangling-pointer case #33.
- Alexander retested the final patch successfully, and Tom committed it unchanged as 6545ba96cb and announced the push #34 #35; the supplied candidate c7edaeec50 is its PostgreSQL 14 backport, representing the same landing.
- The thread ended with the bug fixed and backpatched, while Robert and Tom continued discussing inadequate documentation and reuse of slots for multiple purposes; broader documentation and slot-design changes remained outside this bug fix #36 #37.