Re: PostgreSQL 12 installation fails because locale name contained non-english characters

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Bruce Momjian <bruce(at)momjian(dot)us>
Cc: "Skjalg A(dot) Skagen" <skjalg(dot)skagen(at)pm(dot)me>, "pgsql-bugs(at)lists(dot)postgresql(dot)org" <pgsql-bugs(at)lists(dot)postgresql(dot)org>, pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: PostgreSQL 12 installation fails because locale name contained non-english characters
Date: 2019-11-06 21:24:02
Message-ID: 24194.1573075442@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-hackers

I wrote:
>> I wonder whether we need to relax the matching code to be entirely
>> agnostic about spaces and punctuation in the Windows locale name.

> After googling a little bit, I could not find any indication that
> Microsoft promises anything at all about the stability of these
> long-form locale names. They document short names similar to the
> Unix conventions, e.g. "en-US" and "nb-NO", as being the stable
> forms that applications are encouraged to use. So somewhere there
> is code that converts these long-form names to the standardized
> representation, and it would be entirely reasonable for that code
> to try to be forgiving. Thus, it's no surprise that we're getting
> bit by small variations like these.

> I'm inclined to think that we ought to ignore anything that isn't
> an ASCII letter while trying to match these locale names. That's
> a little bit problematic in terms of what win32setlocale.c does
> today, because it tries to replace "just the matched string",
> but it'd be unclear where the match ends if there are ignorable
> characters. But probably we could change it so that it just takes
> the translation and then tacks on ".NNNN" if the input ends with
> a dot and digits.

> Maybe case insensitivity would be a good idea too? The existing
> code hasn't got that refinement, so maybe it's not important,
> but the examples I'm seeing in places like
> https://docs.microsoft.com/en-us/cpp/c-runtime-library/language-strings?view=vs-2019
> are all-lower-case.

Here's a draft patch for that. I've checked that the logic does
what I expect, but I don't have a way to actually test this thing
in a Windows build. Anyone?

regards, tom lane

Attachment Content-Type Size
rewrite-windows-locale-name-matching.patch text/x-diff 6.9 KB

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Michael Paquier 2019-11-07 02:35:51 Re: BUG #16094: Database entering recovery mode
Previous Message Fujii Masao 2019-11-06 17:41:29 Re: The XLogFindNextRecord() routine find incorrect record start point after a long continuation record

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2019-11-06 21:43:17 Re: TAP tests aren't using the magic words for Windows file access
Previous Message Andrzej Barszcz 2019-11-06 21:12:28 question