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

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

Hi Tom,

If you mean what I see in the drop-down menu during installation, I see "Norwegian Bokmål, Norway" -- identical to what getlocales.exe reported in my installation log file on line 222:

NorwegianxxSPxxBokmålxxCOMMAxxxxSPxxNorway=Norwegian Bokmål, Norway

After installation with the default locale, PgAdmin 4 was giving me encoding errors when it tried to select data from pg_database, so I followed all the steps in this wiki article: https://wiki.postgresql.org/wiki/Changes_To_Norwegian_Locale#What_do_I_need_to_do.3F

However, I had to modify the UPDATE query and remove all the parentheses from the query given by the wiki article, like this:

UPDATE pg_database
SET datcollate = 'Norwegian_Norway' || substr(datcollate, position('.' in datcollate))
WHERE datcollate LIKE 'Norwegian Bokm%' OR datcollate LIKE 'norwegian-bokmal%';

UPDATE pg_database
SET datctype = 'Norwegian_Norway' || substr(datctype, position('.' in datctype))
WHERE datctype LIKE 'Norwegian Bokm%' OR datctype LIKE 'norwegian-bokmal%';

Likewise, lc_messages, lc_monetary, lc_numeric, lc_time in my unmodified postgresql.conf file had no parentheses either, like the wiki article said they should have had:

...
# These settings are initialized by initdb, but they can be changed.
lc_messages = 'Norwegian Bokmål_Norway.1252' # locale for system error message
# strings
lc_monetary = 'Norwegian Bokmål_Norway.1252' # locale for monetary formatting
lc_numeric = 'Norwegian Bokmål_Norway.1252' # locale for number formatting
lc_time = 'Norwegian Bokmål_Norway.1252' # locale for time formatting

The unmodified datcollate and datctypes in pg_database, right after installation with default locale, were as follows:

Query:

SELECT encode(datcollate::bytea, 'escape') as datcollate, encode(datctype::bytea, 'escape') as datctype
FROM pg_database;

Result:

datcollate datctype
Norwegian Bokm\345l_Norway.1252 Norwegian Bokm\345l_Norway.1252
Norwegian Bokm\345l_Norway.1252 Norwegian Bokm\345l_Norway.1252
Norwegian Bokm\345l_Norway.1252 Norwegian Bokm\345l_Norway.1252
Norwegian Bokm\345l_Norway.1252 Norwegian Bokm\345l_Norway.1252

I hope this will be helpful.

Best regards,
Skjalg

‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
On Tuesday, November 5, 2019 6:22 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:

> Bruce Momjian bruce(at)momjian(dot)us writes:
>
> > On Thu, Oct 24, 2019 at 11:06:01AM +0000, Skjalg A. Skagen wrote:
> >
> > > I tried to install PostgreSQL 12 with the "Norwegian Bokmål, Norway" locale in
> > > hope that it would, among other things, provide proper support for Norwegian
> > > characters out-of-the-box.
> > > But initcluster.vbs appear to fail during post-install because the locale name
> > > contains a Norwegian character that is being mishandled (full log in attached
> > > zip file):
> > > initdb: error: invalid locale name "NorwegianBokm†l,Norway"
>
> > This has been fixed with the this patch:
> > https://www.postgresql.org/message-id/E1iMcHC-0007Ci-7G@gemulon.postgresql.org
>
> Hm, I'm not entirely sure that it has been. The original code supposed
> that the locale name is spelled "Norwegian (Bokmål)_Norway", and the
> recent patch you mention extended that to allow "Norwegian Bokmål_Norway".
> But this report, if accurate, shows yet another variant. Skjalg,
> would you confirm that there's a comma and space before "Norway" in
> the locale name as you see it? (Your log clearly shows it with a
> space in the registry entries, but it looks like initdb might be
> seeing it as not having any spaces, which is why I'm confused.)
>
> I wonder whether we need to relax the matching code to be entirely
> agnostic about spaces and punctuation in the Windows locale name.
>
> regards, tom lane

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message PG Bug reporting form 2019-11-06 11:20:15 BUG #16096: psql (non-interactive mode) SQL multi-request commands don't report all feedback ?!
Previous Message Andrey Lepikhov 2019-11-06 05:06:55 Re: The XLogFindNextRecord() routine find incorrect record start point after a long continuation record

Browse pgsql-hackers by date

  From Date Subject
Next Message Grigory Smolkin 2019-11-06 09:33:29 Re: [proposal] recovery_target "latest"
Previous Message Peter Eisentraut 2019-11-06 09:01:40 Re: tableam vs. TOAST