From: | Sandeep Thakkar <sandeep(dot)thakkar(at)enterprisedb(dot)com> |
---|---|
To: | Thomas Munro <thomas(dot)munro(at)gmail(dot)com> |
Cc: | Ben Caspi <benc(at)aidoc(dot)com>, pgsql-bugs(at)lists(dot)postgresql(dot)org, Liran Amrani <lirana(at)aidoc(dot)com>, Avi Uziel <avi(dot)uziel(at)aidoc(dot)com>, Shahar Amram <shahara(at)aidoc(dot)com> |
Subject: | Re: PostgreSQL Windows Installer defaults to "English_United States.1252" when choosing locale starting with "English" |
Date: | 2025-07-13 10:52:27 |
Message-ID: | CANFyU9642ZG81fmUPp7ceUNP+b7ZnpWzAuzsTqoy5p1H+QEpag@mail.gmail.com |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
On Thu, Jul 10, 2025 at 7:24 AM Thomas Munro <thomas(dot)munro(at)gmail(dot)com> wrote:
> On Thu, Jul 10, 2025 at 12:41 AM Sandeep Thakkar
> <sandeep(dot)thakkar(at)enterprisedb(dot)com> wrote:
> > Yes, you are correct. I got the same result. But it was correct when I
> chose the BCP-47 name like en-uk. Probably something to do with how initdb
> is handling the long names.
>
> What's the exact initdb command in this case? I'm a bit confused
> about ""English, United Kingdom" vs "English_United Kingdom.1252". I
> think maybe the Windows C library is doing this, because that first
> form isn't really a supported form, and it only manages to grok the
> first word with some best-match scheme? I don't have Windows but I
> just pushed a stupid test program to CI to test that theory:
>
> #include <locale.h>
> #include <stdio.h>
> #include <stdlib.h>
>
> const char *or_null(const char *s)
> {
> return s == NULL ? "<null>" : s;
> }
>
> int
> main(int argc, char *argv[])
> {
> if (setlocale(LC_ALL, "English, United Kingdom") == NULL)
> printf("error 1\n");
> printf("got: %s\n", or_null(setlocale(LC_ALL, NULL)));
> if (setlocale(LC_ALL, "English_United Kingdom") == NULL)
> printf("error 2\n");
> printf("got: %s\n", or_null(setlocale(LC_ALL, NULL)));
> if (setlocale(LC_ALL, "English_United Kingdom.1252") == NULL)
> printf("error 3\n");
> printf("got: %s\n", or_null(setlocale(LC_ALL, NULL)));
> return EXIT_SUCCESS;
> }
>
> And lo and behold it printed:
>
> got: English_United States.1252
> got: English_United Kingdom.1252
> got: English_United Kingdom.1252
>
> Apparently it really needs that underscore.
>
Here is the initdb command:
---
Executing: "C:\Program Files\PostgreSQL\17\bin\initdb.exe"
--pgdata="C:\Program Files\PostgreSQL\17\data" --username="postgres"
--encoding=UTF8
--pwfile="C:\Users\sandeep\AppData\Local\Temp\postgresql_installer_c27ed92f26\212da2e5.tmp"
--auth=scram-sha-256 --locale="English, United Kingdom"
The files belonging to this database system will be owned by user "sandeep".
This user must also own the server process.
The database cluster will be initialized with locale "English_United
States.1252".
The default text search configuration will be set to "english".
...
...
--
If initdb needs the underscore, then I guess those names need to be
converted in the script:
https://github.com/EnterpriseDB/edb-installers/blob/REL-17/server/scripts/windows/getlocales.ps1
--
Sandeep Thakkar
From | Date | Subject | |
---|---|---|---|
Next Message | 2025-07-14 06:46:25 | Re: The same 2PC data maybe recovered twice | |
Previous Message | a.mitrokhin | 2025-07-11 07:11:43 | Re: Starting a PostgreSQL server on a dynamic port (parameter port=0) |