model-writtenrun 7532 - may be wrong, links go to the source messages. Commit-by-commit LLM analysis is in the Commits dialog.
- Luc Vlaming reported that TPC-DS queries 94–96 failed with “could not find pathkey item to sort,” while disabling Gather Merge avoided the error #1.
- Tomas Vondra suspected the expanded Gather Merge path generation introduced alongside incremental sort, while Robert Haas questioned the displayed plan and requested the relevant target lists; James Coleman clarified the failing stack and traced the mismatch to partial versus ordinary aggregate expressions #2 #6 #8 #3.
- James Coleman supplied a fix requiring all variables and aggregate-like inputs of a proposed sort expression to be available in the relation target; Luc Vlaming confirmed that it resolved all three reported queries, and James added a regression test #10 #11 #12.
- Tomas Vondra requested clearer comments and direct expression matching before the computability checks, and supplied a loop simplification; Zhihong Yu pointed out that the new early return omitted list cleanup #14 #15.
- Tom Lane replaced the duplicated logic with shared helpers that accept either target entries or bare expressions, preserving both direct matches and computable expressions; he separated the public function rename and boolean API change so stable branches could retain the old interface #16.
- Tom Lane refined the shared helper to search past parallel-unsafe equivalence members without requiring broad createplan.c API changes #17.
- James Coleman questioned RelabelType test coverage and the proposed function name; Tom Lane investigated coverage, concluded that computability matching should preserve exact variable matches, and posted a revision removing that relabel stripping and adopting relation_can_be_sorted_early #18 #19 #22 #23.
- Dagfinn Ilmari Mannsåker proposed a separate helper to consolidate repeated RelabelType-stripping loops; James Coleman requested a separate thread, and Tom Lane argued that a macro could avoid the casts required by the proposed inline function #25 #26 #27 #28.
- Tom Lane committed the bug-fix patch from #23 unchanged as 3753982441, crediting James Coleman jointly and backpatching to PostgreSQL 13 while retaining the old tlist helper there for extension compatibility.
- Tom Lane committed the separate rename patch from #23 unchanged as 7645376774 on the development branch and announced completion in #29; the independent RelabelType cleanup from #26 remained unresolved in this thread.