model-writtenrun 7068 - may be wrong, links go to the source messages. Commit-by-commit LLM analysis is in the Commits dialog.
- Tom Lane proposed avoiding tuplestores for scalar and lazily evaluated set-returning SQL functions, using the junkfilter's result slot to retain each returned tuple instead #1.
- The patch also placed necessary tuplestores in per-query memory because a long-lived function cache could outlive the resource owner backing a tuplestore's file; Tom initially planned to defer this precautionary change until PostgreSQL 19 #1.
- Tom subsequently relayed Alexander Lakhin's external report showing that even a single tuple can spill to disk when it exceeds work_mem, undermining the original assumption that scalar functions would never exercise the questionable resource-owner lifetime #2.
- The same report exposed an immediate double-free risk when a long-lived result slot retained a tuple allocated in short-lived memory; Tom decided to apply the existing patch for PostgreSQL 18 because avoiding tuplestore reads eliminated that failure #2.
- The sole patchset #1 landed unchanged as e83a8ae447, completing the proposed work; the thread records no independent patch review.