Re: Speed up ICU case conversion by using ucasemap_utf8To*()
Andreas Karlsson <andreas@proxel.se>
From: Andreas Karlsson <andreas@proxel.se>
To: pgsql-hackers@lists.postgresql.org,
Alexander Lakhin <exclusion@gmail.com>,
Jeff Davis <pgsql@j-davis.com>, zengman <zengman@halodbtech.com>,
pgsql-hackers <pgsql-hackers@postgresql.org>
Date: 2026-04-13T06:35:57Z
Lists: pgsql-hackers
On 1 April 2026 02:46:23 CEST, Andreas Karlsson <andreas@proxel.se> wrote:
>My proposed fix is that we allocate a ULOC_LANG_CAPACITY buffer for the language like we do in fix_icu_locale_str() instead of trying to be clever. An alternative would be to use strncmp("tr", lang, 3) but that seems too clever for my taste in something which is not performance critical. A third option would be to check for U_STRING_NOT_TERMINATED_WARNING but I think that would just be unnecessarily convoluted code.
>
>I have attached my proposed fix.
Since it is likely I introduced or at least exposed this bug somehow I am adding this to the open items for PG 19.
Andreas
Commits
Same data as JSON:
GET /api/v1/messages/:b64id/commits
the thread's linked commits as JSON, with link sources.
API reference →
-
Check for unterminated strings when calling uloc_getLanguage().
- dacd8fa6f259 19 (unreleased) landed
- ca938ec213d9 18.4 landed
- a756067a0e3b 17.10 landed
- 8167371704bd 16.14 landed
-
Fix overrun when comparing with unterminated ICU language string.
- 6393259bd49d 18.4 landed
- 06ce97b9994e 19 (unreleased) landed
-
ICU: use UTF8-optimized case conversion API
- c4ff35f10441 19 (unreleased) landed