model-writtenrun 4204 - may be wrong, links go to the source messages. Commit-by-commit LLM analysis is in the Commits dialog.
- Alexander Lakhin reported intermittent errors and crashes when updating toasted composite values, with evidence that cache invalidation destroyed the tuple descriptor during ExecEvalFieldStoreDeForm() #1.
- Tom Lane supplied a fix that performs detoasting before looking up the descriptor, avoiding additional reference counting, and identified a separate hazard where missing pass-by-reference attributes point into descriptors that can later disappear #2.
- Andres Freund explored descriptor reference counting and transaction-end retention, but discussion established that type-cache invalidation could release descriptors even without meaningful schema changes #3 #4 #5.
- Andrew Dunstan proposed copying missing values into a less volatile cache, initially keyed by type and attribute and cleared at transaction end #6 #7.
- Tom's executor fix from #2 landed with an added regression test in 43af714def; the supplied candidate 7f11b7a9cf is its PostgreSQL 11 backport, and the missing-values issue remained separate.
- Tom raised identifier-reuse and invalidation hazards for an identity-keyed cache, then proposed keying by the datum contents so equal values could share storage without cache invalidation #10 #12 #14.
- Andrew briefly favored returning to identity keys because bytea wrapping seemed complicated, but ultimately implemented content hashing directly without wrapping and submitted the transaction-lifetime cache #17 #18 #19.
- Andres questioned whether procedures could retain values across transaction boundaries, prompting Tom to propose process-lifetime storage; Andres remained concerned about accumulating distinct defaults but accepted that no better solution had emerged #20 #21 #22 #25.
- Andrew revised the cache to use TopMemoryContext and removed transaction cleanup, retaining the same content-keyed design while confining executable code changes to heaptuple.c #27.
- Alexander audited callers and questioned whether the suspected core failure was practically reachable, suggesting targeted fixes and identifying possible extension exposure; Andrew concluded that protecting extensions justified the general mitigation #28 #29.
- Alvaro Herrera challenged the absence of cache cleanup, Andrew explained why transaction boundaries were insufficient, and Tom accepted session-long retention because deduplication should keep its cost below the complexity of reclamation #30 #31 #32.
- Andrew's final patch #27 landed unchanged on the development branch as a684581085, with the supplied candidate 01993ac748 representing its PostgreSQL 12 backport with hash-API adaptations.
- Andrew closed the thread by confirming the missing-values fix had been pushed to all relevant branches, completing both fixes while leaving cache reclamation as a possible future concern rather than pending patch work #33.