model-writtenrun 8381 - may be wrong, links go to the source messages. Commit-by-commit LLM analysis is in the Commits dialog.
- James Lucas reported that explicitly applying deterministic COLLATE still caused LIKE planning to fail on a column with nondeterministic collation #1; after David G. Johnston suggested an index-versus-sequential-scan explanation #2, James reproduced the inconsistency without indexes #3.
- Tom Lane traced the failure to mcv_selectivity applying LIKE to stored statistics using the column's collation, and proposed using the query's collation while recognizing that histogram ordering could then disagree #4.
- James Lucas also questioned distinct-value statistics #5; Tom Lane traced the behavior to ICU comparisons #6, Daniel Verite corrected the locale syntax #7, and James confirmed the expected statistics after that correction #8.
- Tom Lane identified collecting statistics for multiple collations as a possible future improvement, potentially controlled through CREATE STATISTICS, but left it outside this fix #9.
- Tom Lane posted two patches: one propagated query collation through selectivity estimation, and the other checked histogram ordering and counted matching entries when ordering differed #10; the second also corrected range estimation, removed the dummy statistics-collation fallback, and increased statistics precision for affected privileges tests.
- Concerned about extension ABI compatibility and destabilizing existing plans, Tom Lane proposed backporting only the first patch with compatibility wrappers #10 and supplied that PostgreSQL 12 adaptation in the thread's final message #11, before either canonical commit landed.
- The query-collation patch landed unchanged apart from whitespace and offsets as 044c99bc56, with a PostgreSQL 12 backport based on #11 that omitted the ltree changes; the histogram-ordering patch landed with comment and formatting edits as 0c882e52a8 for the development branch only, completing both parts of #10.