model-writtenrun 4154 - may be wrong, links go to the source messages. Commit-by-commit LLM analysis is in the Commits dialog.
- The thread starts with Amit Langote's announcement that JSON conversion functions had been exported for upcoming SQL/JSON constructors to call from the executor #1.
- Alvaro Herrera reported that Coverity subsequently flagged a JsonLexContext leak in datum_to_jsonb_internal(), exposing the lack of a convenient cleanup routine #2.
- Alvaro supplied a patch implementing an idea he attributed to Tom: allow stack-allocated contexts while retaining heap allocation where needed, and add ownership flags and a cleanup routine supporting both #2.
- Alvaro also suggested examining unnecessary free calls and embedding JsonLexContext directly in containing structures; the attachment retained pointer members in those structures #2.
- Alvaro committed the patch as 1c99cde2f3, adding cleanup calls and refining initialization and documentation; the commit explains that the ABI change prevents easy backpatching, and his final message confirms the work was pushed after further tweaking #3.