model-writtenrun 2381 - may be wrong, links go to the source messages. Commit-by-commit LLM analysis is in the Commits dialog.
- jian he reported that adding a column whose unconstrained domain supplied a default left existing rows null, while a constrained domain triggered a rewrite and populated the value; Tom Lane confirmed the regression and opposed fixing it by forcing rewrites #1 #2.
- jian he's initial patch stored domain defaults as missing values without creating pg_attrdef entries, but Tom Lane objected to duplicating StoreAttrDefault and requested separation of default storage from missing-value handling #3 #4.
- jian he extracted a shared helper into heap.c, after which Tom Lane supplied a larger rework centralizing evaluation and rewrite decisions in ATExecAddColumn and separating the backpatchable fix from development-only cleanup #5 #6.
- Tom Lane's rework retained rewrites for constrained domains to preserve the historical behavior of checking constraints only when rows exist, and he deferred avoiding the extra pg_attribute update because that optimization required excessive refactoring #6.
- jian he reviewed the rework, suggested skipping null missing values, and identified ineffective atthasdef initialization in DefineRelation; he then described a separate cleanup attachment, which Tom Lane agreed should be independent #7 #8 #9.
- Tom Lane initially questioned the null optimization but accepted it because it simplified StoreAttrMissingVal, landing the first part of the reworked series with that local logic change as aac07b5625 and backpatching through PostgreSQL 13 #6 #10.
- The second part of the same series landed as 4528768d98, removing obsolete missing-value code and parameters on the development branch while retaining compatibility code in stable branches #6 #10.
- The separate atthasdef cleanup proposed by jian he landed as 35c8dd9e11, removing ineffective DefineRelation assignments and simplifying StoreAttrDefault's update path #7 #8 #9.
- A month later, Alexander Lakhin reported that the domain-default fix caused a multiple-inheritance ADD COLUMN DEFAULT operation to fail with 'tuple already updated by self', and Tom Lane traced the failure to a missing command-counter increment #11 #12.
- Tender Wang supplied the missing CommandCounterIncrement after StoreAttrMissingVal and an inheritance test; Tom Lane landed it with comment and test adjustments as dd34cbfce2, again backpatching through PostgreSQL 13 #13 #14.
- The thread ended with Tender Wang agreeing that the counter increment belonged in the caller and thanking Tom Lane for committing; all supplied patch work had landed, with no further fix pending #15.