Re: Windows default locale vs initdb

Поиск
Список
Период
Сортировка
От Juan José Santamaría Flecha
Тема Re: Windows default locale vs initdb
Дата
Msg-id CAC+AXB2c7icYiXJCwv+4=Di=xZft0NxT=5LP3BcjFnF8ZuBhAg@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Windows default locale vs initdb  (Noah Misch <noah@leadboat.com>)
Ответы Re: Windows default locale vs initdb  (Thomas Munro <thomas.munro@gmail.com>)
Список pgsql-hackers

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.


Regards,

Juan José Santamaría Flecha
Вложения

В списке pgsql-hackers по дате отправления:

Предыдущее
От: Amit Kapila
Дата:
Сообщение: Re: row filtering for logical replication
Следующее
От: Brar Piening
Дата:
Сообщение: Re: Add id's to various elements in protocol.sgml