Re: ICU warnings during make installcheck and text_extensions test

From: Alexander Korotkov <aekorotkov(at)gmail(dot)com>
To: Oleg Tselebrovskiy <o(dot)tselebrovskiy(at)postgrespro(dot)ru>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: ICU warnings during make installcheck and text_extensions test
Date: 2025-07-28 13:04:46
Message-ID: CAPpHfdsEZvbtVFTUp+1WnABvo2dOa17PSr5gF5x-6GzFQhjOrA@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi, Oleg!

On Mon, Mar 31, 2025 at 9:48 AM Oleg Tselebrovskiy
<o(dot)tselebrovskiy(at)postgrespro(dot)ru> wrote:
> When you try to run installcheck using a cluster that was initialized
> with ICU (./initdb -D ../data --locale-provider=icu
> --icu-locale='en_US_POSIX') and NO_LOCALE=1 you get a warning:
>
> # +++ regress install-check in src/test/regress +++
> # using postmaster on Unix socket, default port
> WARNING: could not convert locale name "C" to language tag:
> U_ILLEGAL_ARGUMENT_ERROR
> WARNING: ICU locale "C" has unknown language "c"
> HINT: To disable ICU locale validation, set the parameter
> "icu_validation_level" to "disabled".
>
> This happens with PostgreSQL 16, 17 and master
>
> While this case is somewhat superficial (you need ICU and NO_LOCALE),
> when you try to run installcheck of test_extensions test module (using a
> cluster initialized with ICU) you will get the same warnings due to
> NO_LOCALE=1 in Makefile
>
> There could be an argument "if you are using ICU and don't want warnings
> just set icu_validation_level=disabled in postgresql.conf", but then
> installcheck fails because of collate.icu.utf8 like this:
>
> CREATE COLLATION testx (provider = icu, locale =
> '@colStrength=primary;nonsense=yes'); DROP COLLATION testx;
> -WARNING: could not convert locale name
> "@colStrength=primary;nonsense=yes" to language tag:
> U_ILLEGAL_ARGUMENT_ERROR
> CREATE COLLATION testx (provider = icu, locale = 'nonsense-nowhere');
> DROP COLLATION testx;
> -WARNING: ICU locale "nonsense-nowhere" has unknown language
> "nonsense"
> -HINT: To disable ICU locale validation, set the parameter
> "icu_validation_level" to "disabled".
> CREATE COLLATION test4 FROM nonsense;
>
> And we definitely want to check warnings there
>
> So for now I propose adding icu_validation_level=disabled to pg_regress
> when we were passed NO_LOCALE=1 (patch is attached)
>
> Also since locale 'C' isn't converted to anything with ICU since
> f3a01af, maybe we want to somehow handle NO_LOCALE with ICU in a special
> way? Maybe only during tests?
>
> On another none, test test_extensions from
> src/test/modules/test_extensions fails during installcheck when the
> cluster was initialized with ICU locale. It was already reported at [1].
> This test fails on current REL_17_STABLE (2530367) and master (2a5e709)
>
> One way to fix it is to just skip the test if we find ICU locale
> provider (patch attached bellow), but I'm not sure this is the optimal
> way. In [1] there was an attempt to replace \dx+ with function with
> collation-independent output

Thank you for raising this issue. I don't think ignoring a warning is
an option. The tests contain locale-sensitive orderings. Thus, if we
don't manage to create a C-like locale, tests fail anyway for me.
Ignoring tests is an unfavorable solution.

I see two (better) options to resolve this issue:
1) Specify LOCALE_PROVIDER='builtin' in the CREATE DATABASE command.
2) Specify 'en-US-u-va-posix' as a locale name when template0 has an
ICU locale provider.

The #1 looks simpler. The patch is attached. What do you think?

------
Regards,
Alexander Korotkov
Supabase

Attachment Content-Type Size
pg_regress_locale_provider.patch application/octet-stream 812 bytes

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Daniel Gustafsson 2025-07-28 13:06:23 Re: PG 18 beta1 release notes misses mention of pg_noreturn
Previous Message Andrey Borodin 2025-07-28 12:49:32 Re: IPC/MultixactCreation on the Standby server