model-writtenrun 7003 - may be wrong, links go to the source messages. Commit-by-commit LLM analysis is in the Commits dialog.
- Jeff Davis opened the thread with a five-patch proposal to replace setlocale()-dependent collation behavior with explicit locale objects after the pgconf.dev threading discussion #1, and subsequent glibc tests did not reproduce his initial performance concern #2.
- Jeff added collation-cache simplification in #3; Peter Eisentraut then requested shared libc initialization, preservation of tsearch TODOs, broader NULL cleanup, and removal of an unnecessary intermediate locale-string representation #4.
- Jeff incorporated that feedback in #5, preserving special handling needed by regex use before catalog access, then reordered and consolidated the patches in #7 after Andreas Karlsson's review #6.
- Jeff explained that the database LC_CTYPE environment and the default collation's ctype are distinct, so the database_ctype_is_c global could not simply be replaced with the default collation flag #7; Andreas accepted that distinction and approved the series #8.
- The first patch of #7 landed as 1c461a8d8d with a small local-variable simplification, and Peter reported his renewed approval of the series in #9.
- The non-NULL database locale patch from #7 landed unchanged as 8240401437, followed by the cache refactoring as 72fe6d24a3 with a corrected builtin ctype flag and regression tests.
- For the remaining work, Jeff introduced a separate libc database-environment locale API and changed histogram conversion to use pg_strxfrm() in #10, recognizing that wchar2char() and char2wchar() cannot use arbitrary collation providers.
- Jeff abandoned the new environment-locale API because he disliked its interface, retained NULL support in wchar2char() and char2wchar(), and committed the other NULL cleanups as e9931bfb75; he left tsearch and other environment-locale dependencies for separate work #11.
- The histogram conversion patch from #10 landed as a890ad2149 with additional comment updates, making selectivity estimation use the actual collation provider #11.
- Peter supplied two LIKE cleanups in #12, and Jeff verified their correctness but requested clearer locale flow through generated matching functions and macros #13.
- Peter also identified changed Turkish case conversion in single-byte databases, warning that existing expression indexes could be affected across pg_upgrade #14; Jeff asked whether PostgreSQL 18 release notes were sufficient, with no resolution recorded here #16.
- Tom Lane reported a redundant NULL guard flagged by Coverity in Generic_Text_IC_like() #17; Peter confirmed its removal was safe #18, and Jeff implemented the one-line fix as a459ac504c and acknowledged it in #19.
- Separately, Peter's obsolete SB_lower_char() fallback removal from #12 landed unchanged as 4eb5089e26, while the argument cleanup remained pending.
- Peter proposed eliminating lc_collate_is_c() and lc_ctype_is_c() in favor of direct locale-field access #20; Jeff agreed but highlighted regex use before catalog access and suggested a predefined C locale object #21.
- Andreas instead placed the catalog-free C special case in pg_set_regex_collation() and submitted six cleanup patches covering both wrappers, determinism checks, and sort-support readability #22; Jeff approved their direction while requesting performance testing #23.
- The sort-support readability patch from #22 landed unchanged as a95ff1fe2e, and Andreas resubmitted the remaining five patches with a rebase and provider assertion #24.
- Jeff reported a repeated-lookup regression while evaluating wrapper removal and explained that 12d3345c0d prevented it, while raising remaining invalid-OID concerns #25; that cache optimization originated in Andreas Karlsson's patch #567953 in thread #49789 and landed with light committer edits.
- The lc_collate_is_c() removal from #24 landed as 06421b0843 after Jeff preserved empty-string handling and replaced an invalid-OID assertion with a consistent error #26.
- Jeff extracted and expanded regex global-state error-path cleanup from #24 into 7829f85a62, then committed the remaining lc_ctype_is_c() removal with further local cleanups as 51edc4ca54.
- Peter revised the remaining LIKE patch to pass locale explicitly through MATCH_LOWER() and GETCHAR() #27, and Jeff approved the result #28.
- The remaining determinism work from #24 landed as 6a9fc11033, removing the redundant default-collation check, and b0c30612c5, combining redundant-check removal with elimination of the determinism accessor.
- Peter committed the revised LIKE argument cleanup from #27 unchanged as 433d8f40e9 and confirmed completion in #30.
- A year later, Alexander Kukushkin reported that 06421b0843 broke extension calls to GetSharedSecurityLabel() during authentication because C-collation comparisons now accessed database-local catalogs too early #31.
- Jeff supplied a fix that returns a predefined C locale from pg_newlocale_from_collation() and removes the regex-specific workaround, intending to backport it to PostgreSQL 18 #32.
- At the last message, Alexander had assessed the backport but had not tested PostgreSQL 18, knew of no extension-free reproducer, and noted that testing would require a shared preload module #33; the supplied patch subsequently landed unchanged as d115de9d89, while the previously deferred environment-locale work remained outside this thread's completed changes.