model-writtenrun 8214 - may be wrong, links go to the source messages. Commit-by-commit LLM analysis is in the Commits dialog.
- Tom Gottfried reported that CREATE TABLE LIKE combined with inheritance could copy an index expression with references to the wrong columns, producing a type error on insertion #1.
- Tom Lane traced the problem to renumbering expressions before inheritance determines the final column order, identified similar risks for CHECK and generated expressions, and attached tests showing incorrect results; he initially feared that delaying LIKE processing would be too invasive to backpatch #2.
- Tom Lane supplied a partial implementation that remapped CHECK and generated expressions in MergeAttributes, including generated expressions from inheritance parents, but could not fix indexes because their statements were outside DefineRelation's input; he considered passing statements or attribute maps across those interfaces and questioned the resulting modularity #3.
- Tom Lane then split LIKE processing into two phases, delaying expression-dependent work until after DefineRelation while retaining inherited generated-expression remapping in MergeAttributes; this fixed the index case too and appeared suitable for backpatching #4.
- The complete patch from #4 landed as 5028981923 with only comment edits, and Michael Paquier recorded that it had been backpatched through PostgreSQL 9.5 #5.
- Alexander Lakhin subsequently bisected an assertion failure to that change: creating a table named pg_user with LIKE INCLUDING CONSTRAINTS caused the delayed processing to access the wrong relation #6.
- Tom Lane fixed the regression in 19f5a37b9f by retaining the transformed, schema-qualified target RangeVar and adding a regression test, with backports to all supported branches; his final reply confirmed the fix, leaving no outstanding work stated in the thread #7.