model-writtenrun 3631 - may be wrong, links go to the source messages. Commit-by-commit LLM analysis is in the Commits dialog.
- Richard Guo reported an executor crash caused by untranslated lateral references in TABLESAMPLE expressions during partitionwise joins and proposed storing the sampling clause in a new SampleScanPath in #1.
- Tom Lane suggested delaying reparameterization until plan creation to avoid modifying shared expressions or building unused copies in #2, and Richard replaced the original design with that approach in #3.
- Ashutosh Bapat reviewed the feasibility check, parent-relid handling, and adjustment macros in #8; Richard incorporated clarifications in #9, and Ashutosh subsequently accepted the parent-relid reasoning in #12.
- Tom found that the feasibility check failed to recurse through subpaths in #13, prompting recursive checks and a regression test in #14.
- Tom further corrected the check to ignore subpaths needing no translation, removed a fragile TidPath test, and supplied a revised patch in #16, but testing it on PostgreSQL 15 exposed redundant-qualification regressions.
- Richard traced those regressions to older clause-matching machinery in #17, while Tom judged the backport risk excessive in #18 and supplied a smaller patch rejecting problematic SampleScan paths in #19.
- Ashutosh supplied and tested an alternative that combined feasibility checking and translation through a check_only argument in #20; it was not adopted, consistent with Tom's concerns about conditional complexity and callback compatibility in #16.
- Richard discovered that lateral references in scan restriction clauses could also produce wrong answers or planning errors, and extended the full fix to RelOptInfo and IndexOptInfo expressions in #21.
- Tom questioned whether those expressions should instead be join clauses in #23, and Richard explained how PlaceHolderVars legitimately create restriction clauses containing lateral references in #24 and #26.
- Andrei Lepikhov questioned the remaining path copies in #28, leading Richard to remove them and mutate selected paths directly in #29; the broader path-walker proposal was left for separate discussion.
- Alena Rybakina reviewed the revised code in #31 and considered it ready in #34, while Andrei supplied a detailed favorable review in #36.
- Robert Haas requested clearer documentation, better macro names, and renewed attention to a minimal stable-branch fix in #37; Richard incorporated the presentation changes in #39.
- After Robert requested the separate stable-branch patch in #40, Richard posted both an updated full fix and a conservative fix covering sampling expressions and restriction clauses in #42.
- Tom's review of the conservative fix identified inconsistent Var and PlaceHolderVar handling in #44 and #46, leading Richard to check both placeholder evaluation and lateral dependencies and then unify expression handling in #45 and #47.
- The conservative fix from #47 landed as 2e822a1d62, with a restriction-list helper refactor and branch adaptations; Tom announced its application to stable branches before the February release freeze in #48.
- Richard restored the full development-branch fix as the active submission by reposting the earlier main patch unchanged in #49.
- Tom committed that full fix with cosmetic adjustments as b7e2121ab7 and announced it in #50, preserving deferred translation, recursive feasibility checks, and in-place path updates.
- Richard acknowledged the final landing in #51, leaving both the stable-branch protection and the full development-branch fix committed, with no further patch revision pending in the thread.