model-writtenrun 3491 - may be wrong, links go to the source messages. Commit-by-commit LLM analysis is in the Commits dialog.
- Dean Rasheed proposed WHEN NOT MATCHED BY SOURCE for updating or deleting target rows without a source match, plus optional BY TARGET spelling for existing unmatched inserts, in #1, and added documentation and initial fixes in #2.
- Alvaro Herrera questioned parser-side join optimization and requested enum constants in #3; Dean agreed in #4 and moved join selection into transform_MERGE_to_join(), retained match kinds through planning, and added psql completion in #5.
- Ted Yu proposed an else branch and early exit in the join-selection loop in #8, but Dean declined both in #9 because they offered no useful benefit and reduced readability.
- Vik Fearing examined the feature's standards implications in #10, supported introducing the syntax, and asked that differences from SQL Server be identified for a possible specification.
- Dean initially considered the PlaceHolderVar issue specific to new functionality in #4, but later recognized it as a pre-existing bug and removed its separately addressed fix when rebasing in #11.
- Alvaro requested a grammar explanation and questioned qualification construction in #12; Dean identified make_and_qual() as a simpler equivalent in #13, and Alvaro reported no further observations in #14.
- After outer-join-aware Vars and MERGE deparsing exposed problems, Dean moved source-null tests into planner join construction in #15, marked their Vars nullable, and made deparsing emit explicit BY SOURCE and BY TARGET qualifiers when the extension is used.
- Following more than six months of inactivity, Dean refreshed the patch in #19, and Alvaro encouraged committing the feature while describing his earlier review as incomplete in #20.
- Dean identified plan-dependent concurrent-update behavior in #21: a broken match under a full join could arbitrarily select either unmatched action kind, and he initially proposed always choosing BY TARGET.
- Dean replaced that proposal in #22 with execution of one qualifying action of each unmatched kind, separated view restrictions from MERGE join conditions, and replaced per-action source-null tests with three action lists selected using the join condition.
- After MERGE RETURNING became available, Dean added deferred execution of the second unmatched action and tests for returning both rows in #24, followed by the trivial rebase in #25.
- At the thread's final message, #26, Dean sought commitment and explicitly noted that the substantial executor changes followed the reviewed versions; repeated join-condition evaluation remained an acknowledged implementation tradeoff.
- Dean subsequently committed #25 as 0294df2f1f with light documentation, comment and assertion edits plus a catalog-version bump, completing the feature and crediting Alvaro Herrera, Ted Yu and Vik Fearing for review.