Re: Remaining dependency on setlocale()

Jeff Davis <pgsql@j-davis.com>

From: Jeff Davis <pgsql@j-davis.com>
To: Peter Eisentraut <peter@eisentraut.org>, Chao Li <li.evan.chao@gmail.com>
Cc: Thomas Munro <thomas.munro@gmail.com>, Tom Lane <tgl@sss.pgh.pa.us>, pgsql-hackers@postgresql.org
Date: 2026-01-06T22:20:37Z
Lists: pgsql-hackers
On Tue, 2026-01-06 at 20:54 +0100, Peter Eisentraut wrote:
> On further reflection, it seems just as easy to have dmetaphone()
> take 
> the input collation and use that to do a proper collation-aware 
> upper-casing.  This has the same effect (that is, it will still only 
> support certain single-byte encodings), but it avoids elaborately 
> hard-coding a bunch of things, and if we ever want to make this 
> multibyte-aware, then we'll have to go this way anyway, I think.  See
> attached patch.

Looks good to me.

After you commit that, we still need the changes in fuzzystrmatch.c,
right?

Regards,
	Jeff Davis




Commits

Same data as JSON: GET /api/v1/messages/:b64id/commits the thread's linked commits as JSON, with link sources. API reference →
  1. Fix crash introduced by incorrect backport 806555e300.

  2. fuzzystrmatch: use pg_ascii_toupper().

  3. Make dmetaphone collation-aware

  4. Avoid global LC_CTYPE dependency in pg_locale_icu.c.

  5. downcase_identifier(): use method table from locale provider.

  6. ltree: fix case-insensitive matching.

  7. Fix multibyte issue in ltree_strncasecmp().

  8. Use multibyte-aware extraction of pattern prefixes.

  9. Add pg_iswcased().

  10. Remove char_tolower() API.

  11. Make regex "max_chr" depend on encoding, not provider.

  12. Change some callers to use pg_ascii_toupper().

  13. Allow pg_locale_t APIs to work when ctype_is_c.

  14. Add #define for UNICODE_CASEMAP_BUFSZ.

  15. Inline pg_ascii_tolower() and pg_ascii_toupper().

  16. Avoid global LC_CTYPE dependency in pg_locale_libc.c.

  17. Force LC_COLLATE to C in postmaster.

  18. Change wchar2char() and char2wchar() to accept a locale_t.

  19. Use pg_ascii_tolower()/pg_ascii_toupper() where appropriate.

  20. inet_net_pton.c: use pg_ascii_tolower() rather than tolower().

  21. isn.c: use pg_ascii_toupper() instead of toupper().

  22. contrib/spi/refint.c: use pg_ascii_tolower() instead.

  23. copyfromparse.c: use pg_ascii_tolower() rather than tolower().

  24. Revert "Tidy up locale thread safety in ECPG library."

  25. Tidy up locale thread safety in ECPG library.

  26. All supported systems have locale_t.