model-writtenrun 5115 - may be wrong, links go to the source messages. Commit-by-commit LLM analysis is in the Commits dialog.
- Jehan-Guillaume de Rorthais opened the thread with inconsistent treatment of multiple self-referencing foreign keys during partition attachment in #1, then traced the problem to get_relation_idx_constraint_oid() returning a foreign key and making it the parent of a partition's primary key in #2.
- Alvaro Herrera supplied an initial foreign-key filter in #4 and argued for an explicit index-owning-constraint contract in #6, rather than Zhihong Yu's fallback that could still return a foreign key in #5; Tom Lane endorsed positive filtering and raised inclusion of exclusion constraints in #9.
- Testing the initial fix, Jehan-Guillaume found duplicate foreign-key creation and questioned detach cleanup in #10; Alvaro acknowledged that self-referencing cases had been overlooked and needed additional fixes in #11.
- During that investigation, Jehan-Guillaume submitted an independent fix for malformed names after foreign-key constraint-name collisions in #12; Alvaro committed it with an added regression test as e7936f8b3e and explained in #14 that it was backpatched to version 12, while version 11 did not support the conflicting-name case.
- The new regression test exposed intermittent assertion failures reported by Andres Freund in #16; Tom Lane reproduced them by removing early exit, diagnosed inadequate filtering of self-FK triggers, and proposed keeping the full scan in assertion builds in #17.
- Amit Langote supplied action/check trigger filters and assertion-build full scans in #18, which Alvaro committed with only a comment-punctuation change as 8c848cd4b8 and acknowledged in #19.
- Jehan-Guillaume resumed the original fix in #20, expanding Alvaro's prototype into an explicit primary-key/unique/exclusion filter, preventing duplicate self-FK cloning, and adding tests; he also left an open design question about parenting a partition's primary key to a parent's unique constraint.
- Zhihong corrected a comment in #21, and Jehan-Guillaume incorporated it in the rebased series #22; Alvaro's subsequent review in #23 found an additional NOT VALID initialization bug and suspected a separate ON DELETE SET NULL column-propagation problem.
- Alvaro initially reported extra constraints while backpatching to version 12 in #24, but explained in #25 that this was a mismerge; repeated detach/attach testing revealed a real additional case requiring CloneFkReferenced() to skip constraints originating in the partition-to-be.
- Alvaro committed the revised series from #22 as 614a406b4f, adding that detach/reattach fix and broader tests; his landing report #25 explicitly left the NOT VALID problem and unnecessary trigger-parent dependency rows unresolved.
- Alvaro subsequently fixed the missing Constraint-node initialization and corrected the regression expectations in b0284bfb1d, announcing it in #26 and clarifying that the suspected ON DELETE SET NULL problem was harmless because its column list was propagated separately.
- The thread ends with Jehan-Guillaume's thanks in #27, with all attached fixes landed and the validation follow-up committed; no resolution is recorded for the unnecessary trigger dependencies noted in #25 or the broader constraint-parenting design question in #20.