model-writtenrun 4990 - may be wrong, links go to the source messages. Commit-by-commit LLM analysis is in the Commits dialog.
- Tom Lane proposed a cleaner follow-up to the emergency fix for bug #17679, explaining that binary upgrades could use the existing immediate-unlink path instead of requiring special behavior in the segment-deletion loop #1.
- Andres Freund questioned redundant truncation in the existing implementation and suggested combining first-segment handling with the loop to reduce duplicated code #2.
- Tom Lane rejected that restructuring because the first and subsequent segments require distinct behaviors, arguing that sharing their implementations had caused the original trouble and would complicate future changes #3.
- Tom Lane committed the attached approach with additional errno preservation, continued processing after non-ENOENT truncation failures, and clearer comments in 85d8b30724, derived from #1.
- The thread's final message maintained the separate handling of first and subsequent segments #3; the subsequent commit completed the proposed cleanup and was back-patched to PostgreSQL 15 to keep its implementation aligned with adjacent releases 85d8b30724.