model-writtenrun 5813 - may be wrong, links go to the source messages. Commit-by-commit LLM analysis is in the Commits dialog.
- Alexander Lakhin reported that concurrent DROP STATISTICS and ALTER STATISTICS could crash PostgreSQL 14.1, supplying a reproducer and a stack trace showing a null tuple reaching heap_deform_tuple #1.
- Tomas Vondra reproduced the crash and explained that the statistics tuple could disappear after its OID was checked; he considered the usual cache-lookup error sufficient because concurrent changes already produced errors here #2.
- Tomas supplied a patch adding HeapTupleIsValid immediately after the syscache lookup in AlterStatistics, preventing use of a missing tuple #2.
- Alexander confirmed that the patch worked and reported finding no other instances with his search for missing validity checks; this successful test was the thread's final message #3.
- Tomas subsequently committed the patch unchanged as 6d554e3fcd, with backpatching through PostgreSQL 13, completing the submitted fix.