Re: Remaining dependency on setlocale()

Jeff Davis <pgsql@j-davis.com>

From: Jeff Davis <pgsql@j-davis.com>
To: Александр Кожемякин <a.kozhemyakin@postgrespro.ru>, 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-21T19:30:14Z
Lists: pgsql-hackers

Attachments

On Tue, 2026-01-20 at 12:27 +0700, Александр Кожемякин wrote:
> When executing the following query on branch REL_18_STABLE (first bad
> commit 806555e)

Thank you for the report!

The issue is that the commit in master was dependent on a refactoring
patch, which allowed pg_strfold() to work on any pg_locale_t object,
even if ctype_is_c. Version 18 doesn't have that commit, so it crashed.

It seems to be fine in master, and it was only backported to 18, so the
attached patch is only intended for REL_18_STABLE.

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.