model-writtenrun 5474 - may be wrong, links go to the source messages. Commit-by-commit LLM analysis is in the Commits dialog.
Dec 2020 - Jan 2021 · 3 entries
- Alvaro Herrera revived Simon Riggs and Pavan Deolasee's SQL MERGE implementation in December 2020, initially preserving their approach while rebasing it to current PostgreSQL sources #1.
- Tomas Vondra's initial review identified documentation problems, awkward executor integration, silently ignored rewrite rules and an uninitialized failure-data read; Vik Fearing also requested clearer WHEN-condition error messages #3 #4.
- Jaime Casanova's testing exposed a partition-target crash relayed by Alvaro, while Robert Haas asked about unresolved design objections and Alvaro acknowledged that extensive refactoring remained #8 #9 #10.
Sep 2021 · 1 entry
- After work stalled and the submission was returned for further work, Alvaro resumed in November with Amit Langote's help, removing duplicate target RTEs and improving partition handling and EvalPlanQual #19 #21.
Nov 2021 - Jun 2022 · 23 entries
- Alvaro retained a join-based execution strategy because separately optimizing source and target queries had no demonstrated advantage, while leaving further cleanup open #23.
- Zhihong Yu reviewed assertions and executor control flow, Daniel Westermann found compiler warnings, and Justin Pryzby supplied documentation and code-comment corrections plus successful sqlsmith testing #24 #26 #28 #33 #34.
- The next consolidated version enabled inheritance targets and WHEN MATCHED DO NOTHING, with regression coverage, after Alvaro and Amit established that inheritance already worked with the existing planning machinery #36 #37 #38 #39.
- Simon rebased the work in December and clarified privileges, unsupported targets and documentation examples; an attempted consolidation accidentally restored older implementation code before Alvaro corrected the merge #41 #42 #45 #46.
- Jaime and Erik Rijkers reported further crashes involving partition tuple layouts and target-column references in NOT MATCHED conditions; Japin Li diagnosed the namespace bug and supplied a full corrected version #43 #48 #51.
- Alvaro simplified namespace visibility around MATCHED status, made NOT MATCHED projection use the root descriptor and incorporated the accumulated documentation fixes #53 #54 #55.
- The parser redesign then preserved source and target separately until early optimization, where the join was constructed, and the following revision removed MERGE-specific table-AM hacks in favor of executor result state #58 #59.
- Andres Freund requested smaller reviewable pieces, clearer design documentation and cleaner instrumentation; Justin's testing also exposed node serialization failures that were fixed in the next revision #60 #62 #64.
- Alvaro reorganized update and delete execution into reusable prologue, action and epilogue routines with ModifyTableContext, while temporarily disabling a failing concurrent cross-partition update test #69.
- Tom Lane, Daniel Gustafsson and Julien Rouhaud opposed including implementation files inside nodeModifyTable.c, and the next series kept the MERGE routines in that file while separating transition-table preparation, executor refactoring and MERGE into three patches #71 #73 #74 #75.
- Amit's cross-partition EvalPlanQual fix restored the disabled test, while Alvaro refined the context structures and documented the implementation; transition-table memory budgeting and concurrent INSERT behavior remained discussion points #78.
- Simon confirmed that conflicting concurrent inserts should raise uniqueness errors and supplied missing duplicate-source tests; Alvaro incorporated them and deferred speculative conflict recovery rather than changing MERGE into INSERT ON CONFLICT #81 #82 #94.
- The transition-table prerequisite from #78 landed first as 3a46a45f6f, credited to Pavan Deolasee, with helper renaming, relocation and formatting; the remaining series was resent in #82.
- Amit, Japin and Zhihong reviewed the executor split, and Alvaro subsequently fixed trigger-suppressed operations, moved index maintenance into the update epilogue, normalized node fields and corrected a mistaken cross-partition flag initialization #80 #85 #86 #87 #88 #89.
- The executor split from #89 landed as 25e777cf8e with light editorial and typedef-list changes, leaving MERGE alone in the remaining attachment #91.
- Peter Eisentraut supplied documentation and formatting fixups and recommended less restrictive psql completion; Alvaro incorporated those changes, replaced overloaded instrumentation fields with ModifyTableState counters and simplified grammar construction #93 #95 #96.
- The final attachment #97 became 7103ebb7aa, with an additional executor change to pass already-fetched tuple identity into ExecMerge; Alvaro also reported an immediate buildfarm issue with test role names #98.
- The landed feature supported ordinary, partitioned and inherited tables, security policies and triggers, while leaving foreign-table and updatable-view targets, RETURNING and rewrite rules unsupported 7103ebb7aa.
- After landing, Justin questioned bulk-insert buffer handling; Alvaro, Justin and Robert agreed that MERGE should be considered alongside other modifying commands, and no MERGE-specific buffer change was made in this thread #99 #100 #102 #104.
- Justin proposed more compact EXPLAIN tuple counts, Laurenz Albe endorsed compact output, and Alvaro implemented lowercase key=value counters with zero elision in 598ac10be1 #101 #103 #105 #106.
- Tom Lane immediately noticed that zero-row text output fell back to the verbose format, leading to 12e423e21d, which corrected the conditional and added regression coverage #109 #110.
- Justin also requested a link from the MERGE reference page to concurrency documentation; discussion with Alvaro and Peter led to wording covering all isolation levels and an explicit Repeatable Read mention #101 #107 #108 #112 #114 #115.
- The documentation attachment #115 landed as ffffeebf24, with the MERGE paragraph moved alongside other command-specific Read Committed explanations and an additional markup correction #116.
Aug 2022 · 2 entries
- Justin later questioned the wording about evaluating MATCHED conditions after uniqueness errors; Alvaro explained that MERGE does not restart matched-action evaluation after a failed NOT MATCHED insertion and proposed clearer wording #117 #118 #119.
- At the final message, the feature and earlier fixes had landed, while Justin was reviewing the last wording adjustment and identifying two additional documentation edits; those remaining changes subsequently landed together in 3d895bc846 #120.