model-writtenrun 5875 - may be wrong, links go to the source messages. Commit-by-commit LLM analysis is in the Commits dialog.
- Justin Pryzby reported sqlsmith queries producing internal bogus-varno and bogus-varlevelsup errors in pg_get_expr(), reproducible back to PostgreSQL 10, in #1.
- Tom Lane explained that pg_get_expr() supports only one relation whereas UPDATE rules can reference both OLD and NEW in #2, and Robert Haas supported making the error friendlier in #3.
- Tom posted #4 to validate Vars before deparsing; regression failures also required adding partition-bound support to expression_tree_walker/mutator because psql uses pg_get_expr() to display those bounds.
- Robert questioned treating partition bounds as expressions and called for explicit supported-input rules and sanity checks in #7 and #9; Tom defended existing partition-bound support in #8 and settled on rejecting query trees and unsupported relation references in #10.
- Tom's revised patch #11 retained the original approach, added query-tree rejection and supported-input documentation, and allowed pull_varnos() to operate without a dummy planner context.
- Amit Langote reviewed the partition-bound handling in #12 and suggested examining exprType(), exprCollation(), and query jumbling, then proposed a NodeTag maintenance comment in #13; Robert reiterated support for the walker changes and cleaner errors in #14.
- Tom explained that a partition bound has no meaningful single type or collation and that query-jumbling support would currently be dead code in #15; Amit accepted those exclusions in the thread's last message, #16, leaving the patch ready for commitment.
- Tom subsequently committed #11 as 6867f963e3 with only comment edits; the NodeTag comment suggestion was not included, and the commit explicitly declined back-patching because the fix was essentially cosmetic.