model-writtenrun 4694 - may be wrong, links go to the source messages. Commit-by-commit LLM analysis is in the Commits dialog.
- Alexander Lakhin reported that multi-row INSERTs containing DEFAULT values could trigger an assertion or an unrecognized-node error when an updatable view had a DO ALSO INSERT ... SELECT rule #1.
- Dean Rasheed proposed finding the VALUES range-table entry inside the product query's SELECT, explaining that getInsertSelectQuery() could not be reused because rewritten queries lack its required OLD/NEW placeholders #2.
- Tom Lane requested defensive node-type checks and corresponding hardening of getInsertSelectQuery(); Dean incorporated those changes, and Tom accepted the revision while recommending retaining the existing jointree assertion #3 #4 #5.
- Alexander reported successful extra testing and questioned the INSERT guard; Dean explained that rule actions can also be UPDATE or DELETE, requiring the special descent to remain INSERT-specific #6 #7.
- Alexander then observed that an unresolved DEFAULT became NULL in a rule's NEW reference; Dean explained that this was established, regression-tested behavior and declined to change it #8 #9.
- Dean committed the DEFAULT fix from #4 with the assertion adjustment and test capitalization changes as 75c737636b, backpatching all supported branches.
- Alexander reported a second assertion involving a nested subquery referencing NEW; Dean confirmed that it was independent of DEFAULT handling and also affected INSERT ... SELECT, with a different planner error when subquery pullup was prevented #10 #11.
- Tom diagnosed missing LATERAL markings and argued for adding them implicitly to preserve existing rule definitions; Dean implemented the repair in the rewriter so stored rules would benefit #12 #13.
- Dean broadened the repair after finding an OLD-reference failure in UPDATE rules and added tests for both OLD and NEW; Tom accepted the revised patch while proposing a shortcut for already-lateral subqueries and a fuller explanatory comment #14 #15.
- Dean incorporated Tom's final suggestions into a7d71c41db, based on #14, and backpatched all supported branches; his push announcement and Alexander's thanks closed the thread with both fixes landed #16 #17.