model-writtenrun 9525 - may be wrong, links go to the source messages. Commit-by-commit LLM analysis is in the Commits dialog.
- Chunling Qin reported that a concurrent target-row update could make MERGE switch to NOT MATCHED BY SOURCE while retaining stale source values in action conditions, stored updates, and RETURNING, with two-session reproducers and an executor-level diagnosis #1.
- Tender Wang reproduced the bug and proposed a separate action plan slot using the EPQ result, preserving the original source tuple for a subsequent NOT MATCHED BY TARGET action; existing regression and isolation tests reportedly passed #2.
- Further analysis and AI-assisted testing revealed that a full join could return the source-only row first during EPQ, leaving non-NULL source values even with the initial patch when NOT MATCHED BY TARGET was also present #3.
- Tender Wang revised the patch to supply an explicitly all-NULL plan-shaped slot for NOT MATCHED BY SOURCE conditions, projection, and RETURNING, with local allocation and cleanup while retaining the original source tuple #3.
- Dean Rasheed examined whether nulling the slot's junk target attributes was safe and concluded that those attributes were no longer needed #4.
- Dean Rasheed committed the revised patch #3 with simplified slot bookkeeping, revised comments, and new isolation tests covering concurrent updates with and without NOT MATCHED BY TARGET actions as b291954ea5.
- The thread ends with Dean Rasheed confirming that the fix and isolation tests were pushed and backpatched through PostgreSQL 17, with no outstanding work identified #4.