Re: WIN32 pg_import_system_collations - Mailing list pgsql-hackers

From Juan José Santamaría Flecha
Subject Re: WIN32 pg_import_system_collations
Date
Msg-id CAC+AXB3gf1Uho2S9BZ7vBAaqa5Z-3N34cMc7V60EkcO6-dXcZA@mail.gmail.com
Whole thread Raw
In response to Re: WIN32 pg_import_system_collations  (Andrew Dunstan <andrew@dunslane.net>)
Responses Re: WIN32 pg_import_system_collations
List pgsql-hackers

On Mon, Feb 27, 2023 at 1:10 PM Andrew Dunstan <andrew@dunslane.net> wrote:

On 2023-02-26 Su 16:02, Andrew Dunstan wrote:

Now that I have removed the barrier to testing this in the buildfarm, and added an appropriate locale setting to drongo, we can see that this test fails like this:


diff -w -U3 c:/prog/bf/root/HEAD/pgsql.build/src/test/regress/expected/collate.windows.win1252.out c:/prog/bf/root/HEAD/pgsql.build/src/test/regress/results/collate.windows.win1252.out
--- c:/prog/bf/root/HEAD/pgsql.build/src/test/regress/expected/collate.windows.win1252.out	2023-01-23 04:39:06.755149600 +0000
+++ c:/prog/bf/root/HEAD/pgsql.build/src/test/regress/results/collate.windows.win1252.out	2023-02-26 17:32:54.115515200 +0000
@@ -363,16 +363,17 @@  -- to_char SET lc_time TO 'de_DE';
+ERROR:  invalid value for parameter "lc_time": "de_DE" SELECT to_char(date '2010-03-01', 'DD TMMON YYYY');    to_char -------------
- 01 MRZ 2010
+ 01 MAR 2010 (1 row)  SELECT to_char(date '2010-03-01', 'DD TMMON YYYY' COLLATE "de_DE");    to_char -------------
- 01 MRZ 2010
+ 01 MAR 2010 (1 row)  -- to_date


The last of these is especially an issue, as it doesn't even throw an error.

See <https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=drongo&dt=2023-02-26%2016%3A56%3A30>


Further investigation shows that if we change the two instances of "de_DE" to "de-DE" the tests behave as expected, so it appears that while POSIX style aliases have been created for the BCP 47 style locales, using the POSIX aliases doesn't in fact work. I cant see anything that turns the POSIX locale name back into BCP 47 at the point of use, which seems to be what's needed.


The command that's failing is "SET lc_time TO 'de_DE';", and that area of code is untouched by this patch. As mentioned in [1], the problem seems to come from a Windows bug that the CI images and my development machines have patched out.

I think we should change the locale name to make the test more robust, as the attached. But I don't see a problem with making an alias for the collations.

Regards,

Juan José Santamaría Flecha
Attachment

pgsql-hackers by date:

Previous
From: Andres Freund
Date:
Subject: Re: refactoring relation extension and BufferAlloc(), faster COPY
Next
From: Juan José Santamaría Flecha
Date:
Subject: Re: WIN32 pg_import_system_collations