model-writtenrun 1066 - may be wrong, links go to the source messages. Commit-by-commit LLM analysis is in the Commits dialog.
- SATYANARAYANA NARLAPURAM reported that NOT NULL constraints caused incorrect constant folding of OLD/NEW null tests in RETURNING, demonstrated the failure with MERGE, and submitted fix and test patches in #1.
- Tender Wang confirmed that var_is_nonnullable() overlooked this case, considered the patch sound, and invited Richard Guo to review it in #2.
- Richard Guo approved the patch and explained that has_notnull_forced_var() was unaffected because non-default returning Vars do not appear in WHERE or ON clauses in #3.
- The patch from #1 landed as f6936bf9da, adding the varreturningtype guard and regression coverage with cosmetic edits and tests relocated to returning.sql.
- Richard announced the completed commit and explained the test relocation in #4, leaving no outstanding work identified in the thread.