model-writtenrun 325 - may be wrong, links go to the source messages. Commit-by-commit LLM analysis is in the Commits dialog.
- Mario Karuza reported that tuplesort_putdatum() ignored copied pass-by-reference datum memory, causing incorrect bounded-sort reporting and delayed spilling beyond work_mem, and supplied an allocator-aware accounting fix in #1.
- David Rowley investigated whether datumGetSize() could introduce extra strlen() overhead, concluded that the lack of cstring sort support avoided that concern, and found no issues with the patch in #2.
- Joao Detomini confirmed passing regression tests and the reported fixes, demonstrated that DISTINCT and ordered aggregates also regained expected spilling, and asked about backpatching and documenting increased spilling in #3.
- After David asked how the issue was discovered in #4, Mario explained in #5 that exploration of AIO and spilling exposed suspicious EXPLAIN output and that an AI agent helped trace the execution path; there had been no production incident.
- David committed the unchanged patch from #1 as 85adc584e2 and confirmed backpatching through PostgreSQL 17 in #6, completing the thread’s proposed fix.