model-writtenrun 8865 - may be wrong, links go to the source messages. Commit-by-commit LLM analysis is in the Commits dialog.
- Andreas Joseph Krogh reported an attribute-count error when one ALTER TABLE added ordinary columns and a generated column referencing them; splitting the operation into two statements worked #1.
- Tom Lane initially argued that references between newly added columns should be rejected with a clearer error #2, and Kyotaro Horiguchi supplied a patch implementing that restriction and a regression test #3.
- On reviewing the patch, Tom Lane reconsidered the restriction and demonstrated a related failure when a referenced column changed type, concluding that generation expressions needed the updated tuple values #4.
- Tom Lane traced the assumption to ALTER TABLE itself and supplied a replacement that evaluates ordinary expressions first and generated expressions against the resulting tuple; he left relaxing the restriction on changing types beneath existing generated columns outside the bug fix #5.
- After the final proposal #5, Tom Lane committed its implementation with expanded regression tests as 4ac8aaa36f, crediting Andreas Joseph Krogh's report and backpatching to PostgreSQL 12; the proposed broader relaxation remained unimplemented.