Re: Windows default locale vs initdb
Juan José Santamaría Flecha <juanjo.santamaria@gmail.com>
From: Juan José Santamaría Flecha <juanjo.santamaria@gmail.com>
To: Noah Misch <noah@leadboat.com>
Cc: Thomas Munro <thomas.munro@gmail.com>,
pgsql-hackers <pgsql-hackers@postgresql.org>
Date: 2021-12-15T10:32:38Z
Lists: pgsql-hackers
Attachments
- 0001-POC-Make-Windows-locale-POSIX-looking.patch (application/octet-stream) patch 0001
On Sun, May 16, 2021 at 6:29 AM Noah Misch <noah@leadboat.com> wrote: > On Mon, Apr 19, 2021 at 05:42:51PM +1200, Thomas Munro wrote: > > > The question we asked ourselves > > multiple times in the other thread was how we're supposed to get to > > the modern BCP 47 form when creating the template databases. It looks > > like one possibility, since Vista, is to call > > GetUserDefaultLocaleName()[2] > > > No patch, but I wondered if any Windows hackers have any feedback on > > relative sanity of trying to fix all these problems this way. > > Sounds reasonable. If PostgreSQL v15 would otherwise run on Windows Server > 2003 R2, this is a good time to let that support end. > > The value returned by GetUserDefaultLocaleName() is a system configured parameter, independent of what you set with setlocale(). It might be reasonable for initdb but not for a backend in most cases. You can get the locale POSIX-ish name using GetLocaleInfoEx(), but this is no longer recommended, because using LCIDs is no longer recommended [1]. Although, this would work for legacy locales. Please find attached a POC patch showing this approach. [1] https://docs.microsoft.com/en-us/globalization/locale/locale-names Regards, Juan José Santamaría Flecha
Commits
-
Skip citext_utf8 test on Windows.
- cff4e5a36bfe 17.0 cited