model-writtenrun 5595 - may be wrong, links go to the source messages. Commit-by-commit LLM analysis is in the Commits dialog.
- Thomas Munro reported that CLUSTER's sequential-scan-and-sort strategy produced incorrect ordering for abbreviated expression keys, supplied regression tests, and showed that disabling sequential scans avoided the failure #1.
- John Naylor reproduced the problem on PostgreSQL 10 #2, and Thomas reported seeing garbage expression values during comparetup_cluster() comparisons #3.
- Peter Geoghegan proposed a small backpatchable fix that disabled abbreviation for affected expression-index sorts, judging preservation of the optimization unnecessary #4; Thomas clarified that his separate recent fix had left this older bug present even on master #5.
- Peter supplied a one-line fix requiring haveDatum1 before enabling abbreviation in tuplesort_begin_cluster(), incorporating Thomas's regression tests and crediting both authors #6.
- Peter committed that patch as 8ab0ebb9a8, adding equivalent, behavior-preserving guards to three other sort initialization functions, and announced backpatches to all supported branches #7.
- Thomas acknowledged the completed fix with thanks, and the thread ended with no outstanding work identified #8.