model-writtenrun 2658 - may be wrong, links go to the source messages. Commit-by-commit LLM analysis is in the Commits dialog.
- Mat Arye reported that repeated PL/Python prepared-plan execution consumed about 720 MB versus about 70 MB for equivalent string queries, and supplied a reproducer and scratch-context patch that reduced the usage in #1.
- Tom Lane confirmed the leak and the patch’s effect, but found regression-test failures because result conversion could reset the same scratch context while argument Datums remained live; he also identified the analogous cursor leak and initially suggested using CurTransactionContext in #2.
- Tom corrected that proposal because CurTransactionContext survives subtransaction commit, then supplied a dedicated temporary-context implementation for both execution and cursors, replacing individual Datum frees and removing unnecessary plan-owned argument storage in #3.
- At the thread’s last message, Tom had posted the revised patch for HEAD and specified that stable branches should retain the unused values field for ABI safety; the thread contains no subsequent review or commit announcement #3.
- The following day, 02a38bc84b landed the functional fix from #3 while retaining the values field, its initialization, and its allocation; the commit credits Mat Arye and Tom Lane and states that the fix is to be back-patched to all supported branches.