model-writtenrun 9796 - may be wrong, links go to the source messages. Commit-by-commit LLM analysis is in the Commits dialog.
- Alvaro Herrera reported that crashed sessions could leave temporary tables approaching XID wraparound indefinitely because autovacuum mistook a reused backend ID for ownership, and proposed both session-start cleanup and a database-identity check for older branches #1.
- Robert Haas warned that session-start cleanup could be expensive, and Alvaro's initial implementation raised the further risk that thousands of leftover tables could prevent connections through lock exhaustion; Robert also identified catalog corruption as a possible obstacle #2 #3 #4.
- Tom Lane proposed cleanup after crash recovery or explicit temporary-schema ownership tracking; Andres Freund explained why temporary tables could not simply be ignored for transaction-age accounting, while Robert noted that recovery cleanup would require per-database processes #5 #7 #8 #9.
- Alvaro considered batching deletions across transactions but questioned the complexity, then favored ownership tracking; Michael Paquier pointed out that PGPROC already contained tempNamespaceId, and Tom and Michael explained why transaction visibility and existing deletion locking supported that approach #10 #11 #12 #13 #14 #15.
- Alvaro returned with a tested, conservative autovacuum patch for PostgreSQL 9.4–10 that recognized backend IDs belonging to another database, while acknowledging that same-database reuse remained unresolved; he also proposed DISCARD cleanup and considered backporting the broader PostgreSQL 11 ownership-tracking fix #16.
- Takayuki Tsunakawa favored fixing the bug despite possible extension ABI concerns, and Alvaro posted a combined patch retaining the autovacuum change and adding tested DISCARD cleanup of leftover tables even before temporary-namespace initialization; Takayuki then judged that patch ready to commit #17 #18 #19.
- Michael Paquier supported the conservative backpatch, opposed changing the public PGPROC ABI, suggested an API for the namespace lookup, and requested separate commits for autovacuum and DISCARD; Alvaro later declined the API because this code was unnecessary on PostgreSQL 11 and newer #20 #21.
- Alvaro split #18 into a85045cccb for autovacuum and 2602838fa3 for DISCARD, preserving each implementation unchanged apart from branch context and applying the fixes to PostgreSQL 9.4–10 #21.
- After the commits, Alvaro and Michael continued debating whether appending a PGPROC field would preserve extension compatibility; Alvaro's extension survey found pointer usage, but Tom demonstrated that GetPGProcByNumber depended on the structure's array stride and identified an actual pg_wait_sampling counterexample #22 #23 #24 #25 #26 #27 #28.
- The thread ended with Alvaro accepting the ABI objection: both conservative fixes had landed, the initial session-start cleanup had not been pursued, and the broader ownership-tracking backport remained unapplied, leaving older branches without automatic cleanup for every same-database backend-ID reuse case #29 #16 #21.