model-writtenrun 7119 - may be wrong, links go to the source messages. Commit-by-commit LLM analysis is in the Commits dialog.
Jul - Aug 2023 · 3 entries
- Jehan-Guillaume de Rorthais reported that attaching a table with an existing foreign key to a partitioned table left redundant subsidiary constraints, causing subsequent DETACH to fail while searching for check triggers, and proposed ATTACH-time cleanup with a regression test in #1.
- Alvaro Herrera identified catalog-scan mistakes in #2, while Tender Wang demonstrated that the proposed cleanup could leave a detached table without effective referential-integrity enforcement in #3; Tender then proposed distinguishing inherited constraints during DETACH in #5.
- Tender questioned whether foreign keys should survive detachment, and Alvaro defended preserving them so that reattachment could avoid revalidation in #9, establishing the intended behavior for the main repair.
Oct 2023 · 1 entry
- Tender refined the DETACH filter in #13 but withheld tests because ATTACH still left dangling trigger-parent references; after a long gap and renewed reports, he supplied a rebased version with tests in #14, explicitly leaving that catalog problem unresolved.
Jul - Nov 2024 · 19 entries
- Alvaro corrected operations skipped by Tender's filter in #15, Tender found duplicate action triggers in #16, and Junwang Zhao supplied a revision that reused existing action triggers in #18.
- Alvaro concluded that a complete repair required additional pg_constraint rows and action triggers for every referenced partition in #20, then posted a broader ATTACH/DETACH implementation in #22; Tender reported successful testing, including oidjoins.sql, in #24.
- Backpatching delayed the repair because older branches lacked prerequisite restructuring, so Alvaro proposed dropping foreign keys to partitioned tables on DETACH for those branches in #30, accepting weaker behavior to avoid leaving broken constraints.
- Tender exposed a repeated-deletion failure in that older-branch patch in #31 and analyzed its cause in #32; Alvaro fixed it by collecting deletions for one performMultipleDeletions() call in #33.
- Jehan-Guillaume returned with a detailed review in #35, argued for reusing existing constraint-creation code rather than duplicating it, requested tests that actually exercised referential integrity, and separated the unresolved self-referencing-FK problem from this repair.
- Jehan-Guillaume implemented reusable addFkConstraint() and addFkRecurseReferenced() paths in #39, then expanded the work into tests and three implementation patches in #41, including multilevel partition coverage and reuse from the referencing-side functions.
- Jehan-Guillaume supplied PostgreSQL 17 and PostgreSQL 15 adaptations in #42 and #43, reporting that the former also applied to PostgreSQL 16 while PostgreSQL 14 still required a different solution.
- Alvaro accepted the shared-helper architecture, squashed the patches and supplied branch-specific versions in #44, retaining drop-on-DETACH behavior for PostgreSQL 14 and omitting permanent catalog-dump tests because their output would be costly to maintain.
- Tender identified an always-true condition in #45, and Alvaro removed it along with unused work-queue parameters in #46; that submission also documented leaving PostgreSQL 12 unpatched because of additional differences and its imminent end of support.
- Alvaro announced the repair's landing in #49; the supplied candidate d20194cead contains the older-branch implementation from #44, adapted to PostgreSQL 13 with light edits, while the newer-branch design was represented by #46.
- Although d20194cead also links reports in thread #72625, thread #47776 and thread #72476, its implementation comes from this thread's later patchset #44; the other threads provide no later matching submission.
- Alexander Lakhin then reported a Valgrind-detected invalid read when detaching a partition with dropped columns in #52, and Tender reproduced it and proposed changing the attribute-map index in #54.
- Alexander also reported a separate, preexisting ON DELETE SET DEFAULT column-number anomaly in #57; Tender later showed that the wrong confdelsetcols value already existed before DETACH in #62, and no attached fix for that anomaly appears in the thread.
- Alvaro rejected the proposed index substitution because it generated incorrect constraint-column names and instead removed the unnecessary attribute map in #60, extending the existing regression test to cover differing column layouts.
- Tender approved that correction and identified an unnecessary parent-constraint lookup in #61; Alvaro removed the lookup and added stronger transaction-long locking in #63, which Tender subsequently reviewed in #64.
- The follow-up landed as 1b216fceff, based on #63 with additional CloneFkReferenced() locking corrections and recursive-helper assertions, covering PostgreSQL 15 and later.
- While preparing release notes, Tom Lane asked how users could repair already-damaged constraints in #65; Alvaro confirmed that dropping and recreating them cleaned the catalog and detected inconsistent data in #66, then proposed a detection query in #67.
- Tom found that the detection query incorrectly flagged traditional inheritance in #68, prompting Alvaro to add a partitioned-table guard and generated DROP/ADD commands in #69, with instructions to repair data violations before retrying failed ADD commands.
- The thread ends with the main repair and follow-up landed and Tom accepting the repair guidance in #70; self-referencing foreign-key behavior remained separate work, and the additional confdelsetcols anomaly reported in #57 had no resolution shown here.