model-writtenrun 2209 - may be wrong, links go to the source messages. Commit-by-commit LLM analysis is in the Commits dialog.
- Tom Lane opened the thread with two Valgrind findings: DirectModify could leak its PGresult when execution failed between RETURNING-row calls, while InitPgFdwOptions retained libpq option storage; he proposed a memory-context callback and explicit option-storage cleanup in #1.
- Etsuro Fujita supported extending callback-based cleanup beyond DirectModify, including its potential usefulness for batch INSERT with RETURNING, in #2.
- Tom generalized the fix into a backend PGresult wrapper layer in #3, then switched to macro redirection and allocation with MCXT_ALLOC_NO_OOM in #4 to reduce caller churn while preserving familiar libpq notation.
- The expanded series in #5 separated infrastructure, removal of redundant error-handling code, and indentation for review, retained the options fix, and added a dblink allocation-order fix; Tom reported leak-free postgres_fdw and dblink regression tests under Valgrind.
- Matheus Alcantara endorsed the infrastructure and supplied a delta delaying dblink allocation further in #6, but Tom explained in #7 that allocation after opening a connection could leak that live connection on OOM and proposed creating the hash entry first.
- Tom posted the standalone hash-first dblink redesign in #8, embedding remoteConn in the entry and treating incomplete entries as absent; its commit explanation accepted a residual OOM risk while copying an already-failed connection's error message because that could leak memory but not a live connection.
- Matheus endorsed the standalone dblink fix and the remaining simplification, indentation, and options patches in #9; Tom clarified the application order in #10, committed the dblink fix as e7d3d4ed41, and rebased the four remaining patches in #11.
- For stable branches, Tom returned to the original DirectModify callback approach in #12, avoiding a new backend unregister API and its minor-version compatibility risk; Matheus supported proceeding in #13.
- Tom committed that minimal fix as 271cb7eaa7 with branch-context adaptations, then explained in #14 that the broader change was too invasive after PostgreSQL 18 beta1 and supplied the remaining series for PostgreSQL 19; Etsuro agreed with the decision in #15.
- When development resumed, the infrastructure from #14 landed as 7d8f595779, replacing the narrow DirectModify callback with general wrappers and adding notice-receiver compatibility work that Tom acknowledged in #16.
- The other three patches from #14 landed without substantive changes as caller simplification 80aa9848be, indentation 73873805fb, and options cleanup 0f9d4d7c12.
- Tom announced completion of the larger series in #16, and Etsuro closed the thread with thanks in #17; all submitted work had landed or been superseded, with no patch still awaiting review.