model-writtenrun 2786 - may be wrong, links go to the source messages. Commit-by-commit LLM analysis is in the Commits dialog.
- Alexander Lakhin reported SQLsmith-discovered errors when NULLIF processed arrays through a PL/pgSQL equality function, with debugging evidence of freed array storage #1.
- Tom Lane traced the failure to EEOP_NULLIF passing a read-write expanded-object pointer to an equality function that could legitimately take ownership and free it; his initial patch passed a read-only pointer to the comparison while retaining the original pointer for the result, but lacked JIT support and a regression test #2.
- Tom completed the patch with LLVM support and a regression test using existing case.sql infrastructure, requesting review of whether the LLVM code correctly retained the original read-write pointer #3.
- Dean Rasheed proposed inserting an EEOP_MAKE_READONLY step and clarified that he intended it only for NULLIF; Tom explained that handling conversion inside NULLIF preserves the read-write result for downstream consumers and avoids unnecessary copying #4 #5 #6 #7.
- Dean accepted that explanation in the thread's final message, leaving the completed patch unchanged #8.
- Tom subsequently committed the completed patch from #3 without code changes as 5b8728cd7f, with backports to all supported branches.