model-writtenrun 9437 - may be wrong, links go to the source messages. Commit-by-commit LLM analysis is in the Commits dialog.
- Alan Jackson reported that equivalent-looking date expressions returned different rows from a composite range-partitioned table on PostgreSQL 11.2 #1, and Tom Lane isolated problems involving stable expressions and stable cross-type comparison operators #2.
- Amit Langote traced one failure to pruning with the last operator's strategy after an unavailable expression had been dropped, and proposed substituting equality for the surviving prefix #3.
- Kyotaro Horiguchi showed that reversing the partition-key order still produced incorrect results and spotted a comment typo #4; Amit consequently added a separate fix to stop considering later keys after a non-inclusive comparison #5.
- Tom demonstrated that the revised patch still allowed planning-time pruning with stable timestamp-versus-timestamptz operators #8, prompting Amit to add mutable-clause filtering and runtime-pruning support as another patch #9.
- David Rowley proposed centralizing the decision in match_clause_to_partition_key() and distinguishing planning from execution #10; after Amit demonstrated that Const arguments can still use stable operators #11, David added operator immutability checks and incorporated Amit's runtime-analysis changes #12.
- Tom favored David's centralized checks but requested a context field instead of propagating an enum through the call stack #14; David supplied that revision and a PostgreSQL 11 adaptation #15 #16, while Amit consolidated the composite-range patches and collected the proposed fixes together #18.
- David observed that the stable-operator fix made the existing composite-range tests ineffective and proposed tests mixing startup and execution parameters #19; Amit rewrote those tests #21, and David separately incorporated a master-only planstate assertion and documentation corrections #20.
- Tom added missing ScalarArrayOp handling and questioned the repeated analysis of pruning steps #22; David explained why runtime steps must retain constant clauses needed in combinations such as multicolumn hash keys #23, and Amit explained why partially generated steps could not simply be reused #29.
- Tom committed the stable-comparison fix from #22 as 4b1fcb43d0, adding array-comparison tests and small cleanups, and announced that broader restructuring would wait while he examined the remaining range-key patch #30.
- Tom then demonstrated that Amit's equality fallback incorrectly changes an inclusive inequality into equality, and argued that separate pruning-step generation for planning, executor startup, and execution was the safest fix #31.
- The independent non-inclusive range-key fix from #21 landed as 3922f10646; Tom confirmed the partial landing and supplied failing tests for the unresolved startup-pruning cases #32.
- Tom supplied a prototype with separate startup and execution pruning lists, fixing those tests but still generating unnecessary pruning work #33.
- Amit proposed a delta that inspected clauses and parameters before generating runtime steps #36; Tom instead completed the implementation by collecting requirement flags during step generation and moving internal inputs and outputs into GeneratePruningStepsContext #38.
- Tom used temporary EXPLAIN instrumentation to compare pruning decisions, explicitly excluded that instrumentation from the proposed commit, and discussed preserving existing plan-node fields for PostgreSQL 11 compatibility #38.
- The completed restructuring from #38 landed as 6630ccad7a, with an additional executor cleanup storing the partition count directly in PartitionedRelPruningData.
- After that commit, David proposed caching execution parameter IDs to reduce repeated expression walks #39, but Tom questioned whether clause acceptance could be determined safely through recursive AND/OR processing #40.
- The thread ended with the three correctness fixes committed and the additional optimization unresolved: Amit explained that collecting IDs when steps are built would merely relocate the work, and abandoned an early-skipping idea because it conflicted with recursive OR semantics #41.