model-writtenrun 4094 - may be wrong, links go to the source messages. Commit-by-commit LLM analysis is in the Commits dialog.
- Will Mortensen reported a race diagnosed with Jacob Speidel in which a connection failing during DROP DATABASE recreated statistics for the dropped database, leaving a phantom entry that could indefinitely stall autovacuum scheduling #1.
- Andres Freund initially considered clearing database identifiers on connection failure, then concluded that the shared pg_database catalog could be rechecked before assigning those identifiers; his prototype delayed MyDatabaseId assignment and skipped database-statistics updates when it was invalid #2 #3 #4.
- Will relayed Jacob's successful prototype test, and subsequent investigation confirmed that ordinary connections could trigger the bug as well as autovacuum workers; Michael Paquier supplied a reproduction using catalog locking #5 #7 #8.
- Michael questioned the effect on startup-process statistics and suggested checking for dropped statistics entries during shutdown, while Andres argued that startup-process database statistics were already ineffective and that the shutdown-check alternative was inappropriate #6 #9 #10 #11.
- After a gap, Jacob confirmed that PostgreSQL 15.4 still had the bug and that the prototype still fixed it; Michael accepted the logic while asking for clearer expectations around startup-process statistics #12 #15.
- Michael posted a revised patch retaining Andres's design, correcting PANIC to FATAL and accommodating the newer invalid-database check, while explicitly leaving per-database startup-process counters and their overhead investigation for separate work #16.
- Nathan Bossart judged the revised logic sound and requested a comment explaining why database identifiers must remain unset until concurrent drops or renames are excluded; he and Michael agreed on wording describing the statistics shutdown callback #17 #18 #19 #20 #21.
- Michael committed the revised patch as 2b8e5273e9, adding only the agreed explanatory comment to #16, and announced backpatching through PostgreSQL 15 #22.
- The thread closed with thanks from Will and Andres after the fix landed, with no further patch pending; the broader startup-process statistics work remained outside this fix #23 #24 #16.