model-writtenrun 1878 - may be wrong, links go to the source messages. Commit-by-commit LLM analysis is in the Commits dialog.
- Haiyang Li reported that a numeric NOT IN query could exhaust memory because hashed subplans retained detoasted values in an unreset temporary context, supplied a reproducer in #1, and attached a caller-side reset patch in #2.
- Fei Changhong proposed resetting memory inside the hash-table API and observed that the proposed regression test could not detect the leak in #4; Tom Lane initially opposed additional API-level resets and requested a common cleanup exit in ExecHashSubPlan in #5.
- Haiyang Li implemented the common-exit approach, retained resets during hash-table construction, and dropped the regression test in #7, following the conclusion that a portable regression test could not reliably demonstrate memory exhaustion.
- After bisecting the behavior change to an older expression-evaluation rewrite, Tom Lane reconsidered Fei Changhong's proposal and supplied #8, which moved resets into four execGrouping.c API functions to cover callers generally.
- Haiyang Li warned that those API functions could reset shared caller contexts prematurely in #9, and Fei Changhong suggested an independently owned context in #10; Tom Lane instead chose to preserve caller ownership, document the reset obligation, and avoid redundant contexts in #11.
- Tom Lane's two-patch submission in #12 returned to Haiyang Li's caller-side fix with simpler control flow, then separately removed the redundant hash temporary context for master only, keeping the backpatch conservative.
- Haiyang Li approved both patches in #13, while Fei Changhong approved and tested the leak fix, proposed a debug assertion for excessive temporary-context memory, and questioned whether the cleanup revived an old bug in #14.
- Haiyang Li investigated the historical lifetime concern in #16; Tom Lane explained that tuple comparison now resets an independent context and reported that the old regression case passed even under Valgrind in #17, after which Haiyang Li and Fei Changhong renewed approval of the master-only cleanup in #18 and #19.
- The first patch of #12 landed as 8b6c29afd1, preserving its code changes apart from branch context and backpatching the leak fix through PostgreSQL 13; the second landed with an identical diff as the master-only cleanup bdc6cfcd12, with an expanded historical explanation.
- Tom Lane confirmed both changes were committed in #20 and left the proposed memory-leak assertion out because it was too specialized and messy, suggesting that a more generic approach could be considered later.