model-writtenrun 85 - may be wrong, links go to the source messages. Commit-by-commit LLM analysis is in the Commits dialog.
- Henson Choi reported that EXPLAIN could print a data-modifying CTE's OLD/NEW aliases inside another statement's RETURNING SubPlans, and supplied regression tests plus a fix moving alias setup into set_deparse_plan(); query results were unaffected #1.
- Tom Lane committed both patches as 4ee8af2e86, additionally clearing aliases outside ModifyTable nodes and asserting that RETURNING references always have aliases #2.
- Ayush Tiwari found that a rule combined with a triggering query aliased as old or new could trip the new assertions, and proposed preserving the rule's aliases when the triggering query had none #3.
- Dean Rasheed initially favored removing the assertions because exposing a rule-only alias could confuse users, and Tom initially agreed #5 #6.
- Tom reconsidered because EXPLAIN already exposes rewritten rule details, proposed giving the rule's aliases precedence, and traced how aliases from either level could be absent or mixed during rewriting #8 #9.
- Ayush tested Tom's alternative successfully for both OLD and NEW and confirmed that Vars from the two levels become indistinguishable; Dean explained the alias-propagation rules and accepted either that fix or assertion removal #10 #12 #14.
- Tom considered representing RETURNING references through additional range-table entries but declined a redesign for this rare case, while Dean argued that EXPLAIN's alias.column notation itself cannot express every distinction #11 #15 #16.
- Henson demonstrated that preferring rule aliases could print distinct old and new values with the same name, and Dean supplied another misleading-output example plus an inline alternative that substituted old or new when an alias was missing #17 #18.
- After testing the alternatives, Henson preferred Tom's approach because it preserved explicitly chosen names when aliases did not collide; Dean remained concerned about collisions and suggested uppercase fallback names, while Tom noted that those would be quoted and favored preserving useful names in non-colliding cases #19 #20 #21 #22.
- Dean then demonstrated that preferring rule aliases also worsened an ordinary query without unusual aliases, renewing his recommendation to remove the assertions or use fallback names; his subsequent correction to the example's comments did not change that conclusion #23 #24.
- Tom agreed to remove the assertions and committed b049b4e7b4, leaving the original alias-context fix intact and abandoning the proposed rewriter changes and fallback-name alternatives #25.
- Dean's final acknowledgment closed the thread with the original EXPLAIN fix and assertion-removal follow-up landed, while the broader ambiguity of mixed rule and query aliases remained unresolved #26.