Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sVraJ-00C2Ud-O8 for pgsql-general@arkaria.postgresql.org; Mon, 22 Jul 2024 11:52:07 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1sVraG-000Kh7-RT for pgsql-general@arkaria.postgresql.org; Mon, 22 Jul 2024 11:52:05 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sVraG-000KeD-Df for pgsql-general@lists.postgresql.org; Mon, 22 Jul 2024 11:52:04 +0000 Received: from mail-yb1-xb2a.google.com ([2607:f8b0:4864:20::b2a]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1sVra9-000rk0-4O for pgsql-general@lists.postgresql.org; Mon, 22 Jul 2024 11:52:03 +0000 Received: by mail-yb1-xb2a.google.com with SMTP id 3f1490d57ef6-e03a17a50a9so4424560276.1 for ; Mon, 22 Jul 2024 04:51:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=enterprisedb.com; s=google; t=1721649115; x=1722253915; darn=lists.postgresql.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=VCpKgVLUWLfQGcvZOHofqP+iiWxEknMn1QqSxOFJvp4=; b=WjOaPn+YxHm6/Qqy9Fu45CguJCLgHUNmIV5QrvJ65di2Zm+t3MOjd7uy/7ynmbarLA qQ0ds/iFPqJpHMDMzkT3H5RQfaewWSr3qTK9QiF9efGp/8dAaFc8YfAjR1G6CZYQ7wOL lUGLxjVMS9USFzBWjw28iaoHv8D3KzTEyFqPiQWsnIdlozepkZ7oLXzucXIffbvOqe2O Q0u8nHoKBaNc+sGaz5cKSGvQAN5S8yw6jaOO/4aGE5Sn10NftvFy/yOHyPyKqj397UiI ea7eA7t9M62wXCiszeyB0+5bNk/+BgCH5oledT6BfIU1/f7RjrA0gVUVF8SU3D+rcEox N4vw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721649115; x=1722253915; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=VCpKgVLUWLfQGcvZOHofqP+iiWxEknMn1QqSxOFJvp4=; b=E2mboog5IMQinr/v+Z0P99L1+OT1uFkIyYreA5meQbUT1478vZdkYkIh3WOSkZmudp CbrzAJrWA3j3DFZ2lqWQaMFt8aG5mUBU8llWtDh7A6YsLGyE4AJka4nMfTOUY5/teSpB 6q/4h42y1/kewn0uZkLi+7DVjAYo120JE6/OnG+Z9jeHlO5Rh0RX4eIhe7MjrSBwa6h7 3xe02yzhHCLkamy2+xZs75zHEhPWqMh0Vq7Q2zppGGo0xPkhUM9gqN7k5ND6YXACSU6B YDLur6hOWXCbsHuuYhVk/3onB3CVvC/8tDJkn1oeQc6ozA4EzpWzqHFSol2dK/pbFoRJ qHrQ== X-Forwarded-Encrypted: i=1; AJvYcCUySXHs5q9h/7u8yfdZEmqX+8nQ66UT3F9/bM8/8v3mGwrQ1xdPHNYUfJB7gTZsDngWmGezEGLLM2d0pD2YzrVm+1ab+pUvoR9I48WosI8EcgRW X-Gm-Message-State: AOJu0YyRYX9PHn26MeK3LDy2TmCuhBvU4SXuF74rF8jgY3pNLqr1yOQ0 SEIfhH/4B+dBOOy4Ffvm5YK5nNgSk0lkrcqTR/WyMfuhTuouYE/RcGN0fZfFO4mTxQeVHeQeCH7 c/yvXfqsQnFxYjK6je2drfBgwcYF/ZZXnCJZY X-Google-Smtp-Source: AGHT+IHvZQedY7xVD3/rDpYzUjxmvVGLDuWL3Reotym0aLHv7HAl41Dr1eu8byUOGZw/+3oau6yXVqNbtbmvPSCCejI= X-Received: by 2002:a05:6902:2e0a:b0:e03:b14e:350f with SMTP id 3f1490d57ef6-e08706add65mr7844310276.50.1721649114590; Mon, 22 Jul 2024 04:51:54 -0700 (PDT) MIME-Version: 1.0 References: <80c9b0ea-c874-40ad-a006-fb1eb37464c2@aklaver.com> <44b44ece-dce6-4b4f-b751-8787a5a071e0@aklaver.com> In-Reply-To: From: Sandeep Thakkar Date: Mon, 22 Jul 2024 17:21:38 +0530 Message-ID: Subject: Re: Windows installation problem at post-install step To: Thomas Munro Cc: =?UTF-8?B?RXJ0YW4gS8O8w6fDvGtvZ2x1?= , Adrian Klaver , pgsql-general@lists.postgresql.org, Dave Page Content-Type: multipart/alternative; boundary="000000000000e74c2f061dd4ab3e" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --000000000000e74c2f061dd4ab3e Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hi, EDB's windows installer gets the locales on the system using the https://github.com/EnterpriseDB/edb-installers/blob/REL-16/server/scripts/w= indows/getlocales/getlocales.cpp and then substitute some patterns ( https://github.com/EnterpriseDB/edb-installers/blob/REL-16/server/pgserver.= xml.in#L2850) I'm not sure why we do that but that is the old code and probably @Dave Pag= e may know but I'm not sure if that piece of code is responsible for this change in encoding in this case. When I checked the installation log shared by Ertan, I do see that the locale passed to initcluster script is the same as returned by the getlocales executable. Executing C:\Windows\System32\cscript //NoLogo "C:\Program Files\PostgreSQL\16/installer/server/initcluster.vbs" "NT AUTHORITY\NetworkService" "postgres" "****" "C:\Users\User1\AppData\Local\Temp/postgresql_installer_cd79fad8b7" "C:\Program Files\PostgreSQL\16" "C:\DATA_PG16" 5432 "Turkish,T=C3=BCrkiye"= 0 On Mon, Jul 22, 2024 at 6:43=E2=80=AFAM Thomas Munro wrote: > On Mon, Jul 22, 2024 at 11:58=E2=80=AFAM Ertan K=C3=BC=C3=A7=C3=BCkoglu > wrote: > > Thomas Munro , 21 Tem 2024 Paz, 23:27 tarihinde > =C5=9Funu yazd=C4=B1: > >> 2. Some existing database clusters which had been installed with the > >> name "Turkish_Turkey.1254" became unstartable when the OS upgrade > >> renamed that locale to "Turkish_T=C3=BCrkiye.1254". I'm trying to pro= vide > >> a pathway[2] to fix such systems in core PostgreSQL in the next minor > >> release. Everyone affected probably already found another way but at > >> least next time a country is renamed this might help with the next > >> point too. > > > > I was also hit by that OS update. > > There is a Microsoft tool for creating a locale installer > > https://www.microsoft.com/en-us/download/details.aspx?id=3D41158 > > Using that tool and adding a second locale Turkish_Turkey.1254 (name > before Microsoft update) in the OS can fix your broken PostgreSQL. > > I believe most people simply choose this path. > > There are also several blogs/articles written in Turkish about the > problem. > > If that's easy and good enough then maybe I should abandon that > on-the-fly renaming patch and we should just do a little documentation > note... > > >> 3. I'd also like to teach initdb to use BCP47 names like "tr-TR" > >> instead of those names by default (ie if you don't specify a locale > >> name explicitly), and have proposed that before[3] but it hasn't gone > >> in due to lack of testing/reviews from Windows users. It seems like > >> that doesn't matter much in practice to all the people using the > >> popular EDB installer, since it apparently takes control of picking > >> the locale and explicitly passes it in (and screws up the encoding as > >> we have now learned). > > > > If I am not mistaken BCP47 names are already used in Linux systems. > > Using them would make PostgreSQL use the same locale names across Linux > and Windows systems. > > Not exactly. POSIX systems use > [language[_territory][.codeset][@modifier]], but POSIX doesn't say > what any of those components are[1] (are they ISO country codes? > English words? Hieroglyphs?), so, curiously, those Windows names like > "English_United States.1252" are probably POSIX-conforming. Every > real POSIX system of course uses ISO language and country codes these > days (though I still recall other names being used years ago), so they > look similar to the simpler kinds of BCP47 tags, which are just > language-country with the same ISO codes but a different separator. > They diverge further once you get into the finer points with more > components. Incidentally that lack of standardisation is the reason > you can't say that the glibc ".utf8" ending is "wrong", even though it > is obviously stupid :-p (all systems I know accept .UTF-8, 'cause > that's what Ken Thompson, Rob Pike and the Unicode standard called > it). I suspect that Windows accepts the POSIX style en_US too, but > it's not what the manual tells you to use. > > But really we shouldn't have to know or care how locales are named; we > should get the names from the OS in the first place, and then we > should remember them and give them back to the OS at the right times. > The two problems here is that Windows has two kinds, one unstable over > time and with illegal (for us) characters in the name, and one stable; > we need to find all the places where the old unstable ones can get > into our system, and block them off. I'm aware of two places now: the > EDB installer, and initdb's default for people who run it on the > command line with giving an explicit name. > > > I can help with the testing part. Let me know the details, please. > > Thanks! I will rebase that patch, and CC you on the thread. > > [1] > https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap08.html > --=20 Sandeep Thakkar --000000000000e74c2f061dd4ab3e Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi,
EDB's windows installer gets the locales on the system using the= =C2=A0https:= //github.com/EnterpriseDB/edb-installers/blob/REL-16/server/scripts/windows= /getlocales/getlocales.cpp=C2=A0and then substitute=C2=A0some patterns = (
https://github.com/EnterpriseDB/edb-instal= lers/blob/REL-16/server/pgserver.xml.in#L2850) I'm not sure why we = do that but that is the old code and probably=C2=A0@Dave Page=C2=A0 may know but I'm not sure if that piec= e of code is responsible for this change in encoding=C2=A0in this case.
=
When I checked the installation log shared by Ertan, I do see that the = locale passed=C2=A0to initcluster script is the same as returned by the get= locales executable.

Executing C:\Windows\System32\cscript //NoLogo &= quot;C:\Program Files\PostgreSQL\16/installer/server/initcluster.vbs" = "NT AUTHORITY\NetworkService" "postgres" "****&quo= t; "C:\Users\User1\AppData\Local\Temp/postgresql_installer_cd79fad8b7&= quot; "C:\Program Files\PostgreSQL\16" "C:\DATA_PG16" 5= 432 "Turkish,T=C3=BCrkiye" 0

On Mon, Jul 22, 2024 at 6:4= 3=E2=80=AFAM Thomas Munro <thomas.munro@gmail.com> wrote:
On Mon, Jul 22, 2024 at 11:58=E2=80=AF= AM Ertan K=C3=BC=C3=A7=C3=BCkoglu
<ertan.ku= cukoglu@gmail.com> wrote:
> Thomas Munro <thomas.munro@gmail.com>, 21 Tem 2024 Paz, 23:27 tarihinde =C5= =9Funu yazd=C4=B1:
>> 2.=C2=A0 Some existing database clusters which had been installed = with the
>> name "Turkish_Turkey.1254" became unstartable when the O= S upgrade
>> renamed that locale to "Turkish_T=C3=BCrkiye.1254".=C2= =A0 I'm trying to provide
>> a pathway[2] to fix such systems in core PostgreSQL in the next mi= nor
>> release.=C2=A0 Everyone affected probably already found another wa= y but at
>> least next time a country is renamed this might help with the next=
>> point too.
>
> I was also hit by that OS update.
> There is a Microsoft tool for creating a locale installer
> https://www.microsoft.com/en-us= /download/details.aspx?id=3D41158
> Using that tool and adding a second locale Turkish_Turkey.1254 (name b= efore Microsoft update) in the OS can fix your broken PostgreSQL.
> I believe most people simply choose this path.
> There are also several blogs/articles written in Turkish about the pro= blem.

If that's easy and good enough then maybe I should abandon that
on-the-fly renaming patch and we should just do a little documentation
note...

>> 3.=C2=A0 I'd also like to teach initdb to use BCP47 names like= "tr-TR"
>> instead of those names by default (ie if you don't specify a l= ocale
>> name explicitly), and have proposed that before[3] but it hasn'= ;t gone
>> in due to lack of testing/reviews from Windows users.=C2=A0 It see= ms like
>> that doesn't matter much in practice to all the people using t= he
>> popular EDB installer, since it apparently takes control of pickin= g
>> the locale and explicitly passes it in (and screws up the encoding= as
>> we have now learned).
>
> If I am not mistaken BCP47 names are already used in Linux systems. > Using them would make PostgreSQL use the same locale names across Linu= x and Windows systems.

Not exactly.=C2=A0 POSIX systems use
[language[_territory][.codeset][@modifier]], but POSIX doesn't say
what any of those components are[1] (are they ISO country codes?
English words?=C2=A0 Hieroglyphs?), so, curiously, those Windows names like=
"English_United States.1252" are probably POSIX-conforming.=C2=A0= Every
real POSIX system of course uses ISO language and country codes these
days (though I still recall other names being used years ago), so they
look similar to the simpler kinds of BCP47 tags, which are just
language-country with the same ISO codes but a different separator.
They diverge further once you get into the finer points with more
components.=C2=A0 Incidentally that lack of standardisation is the reason you can't say that the glibc ".utf8" ending is "wrong&qu= ot;, even though it
is obviously stupid :-p (all systems I know accept .UTF-8, 'cause
that's what Ken Thompson, Rob Pike and the Unicode standard called
it).=C2=A0 I suspect that Windows accepts the POSIX style en_US too, but it's not what the manual tells you to use.

But really we shouldn't have to know or care how locales are named; we<= br> should get the names from the OS in the first place, and then we
should remember them and give them back to the OS at the right times.
The two problems here is that Windows has two kinds, one unstable over
time and with illegal (for us) characters in the name, and one stable;
we need to find all the places where the old unstable ones can get
into our system, and block them off.=C2=A0 I'm aware of two places now:= the
EDB installer, and initdb's default for people who run it on the
command line with giving an explicit name.

> I can help with the testing part. Let me know the details, please.

Thanks!=C2=A0 I will rebase that patch, and CC you on the thread.

[1] https://pubs.opengroup.o= rg/onlinepubs/9699919799/basedefs/V1_chap08.html


--
Sandeep Thakkar


--000000000000e74c2f061dd4ab3e--