From: | Juan José Santamaría Flecha <juanjo(dot)santamaria(at)gmail(dot)com> |
---|---|
To: | Noah Misch <noah(at)leadboat(dot)com> |
Cc: | Thomas Munro <thomas(dot)munro(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: Windows default locale vs initdb |
Date: | 2021-12-15 10:32:38 |
Message-ID: | CAC+AXB2c7icYiXJCwv+4=Di=xZft0NxT=5LP3BcjFnF8ZuBhAg@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Sun, May 16, 2021 at 6:29 AM Noah Misch <noah(at)leadboat(dot)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
Attachment | Content-Type | Size |
---|---|---|
0001-POC-Make-Windows-locale-POSIX-looking.patch | application/octet-stream | 1.1 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Brar Piening | 2021-12-15 11:07:47 | Re: Add id's to various elements in protocol.sgml |
Previous Message | Amit Kapila | 2021-12-15 10:13:21 | Re: row filtering for logical replication |