pgsql: Another attempt at fixing Windows Norwegian locale.

From: Heikki Linnakangas <heikki(dot)linnakangas(at)iki(dot)fi>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Another attempt at fixing Windows Norwegian locale.
Date: 2015-01-16 11:28:59
Message-ID: E1YC55H-0000io-Lh@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers pgsql-hackers

Another attempt at fixing Windows Norwegian locale.

Previous fix mapped "Norwegian (Bokmål)" locale, which contains a non-ASCII
character, to the pure ASCII alias "norwegian-bokmal". However, it turns
out that more recent versions of the CRT library, in particular MSVCR110
(Visual Studio 2012), changed the behaviour of setlocale() so that if
you pass "norwegian-bokmal" to setlocale, it returns "Norwegian_Norway".

That meant trouble, when setlocale(..., NULL) first returned
"Norwegian (Bokmål)_Norway", which we mapped to "norwegian-bokmal_Norway",
but another call to setlocale(..., "norwegian-bokmal_Norway") returned
"Norwegian_Norway". That caused PostgreSQL to think that they are different
locales, and therefore not compatible. That caused initdb to fail at
CREATE DATABASE.

Older CRT versions seem to accept "Norwegian_Norway" too, so change the
mapping to return "Norwegian_Norway" instead of "norwegian-bokmal".

Backpatch to 9.2 like the previous attempt. We haven't made a release that
includes the previous fix yet, so we don't need to worry about changing the
locale of existing clusters from "norwegian-bokmal" to "Norwegian_Norway".
(Doing any mapping like this at all requires changing the locale of
existing databases; the release notes need to include instructions for
that).

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/aa1d2fc5e91e396bec5bf8a8d10b6cc4af0b0fff

Modified Files
--------------
src/port/win32setlocale.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2015-01-16 14:17:05 Re: pgsql: Another attempt at fixing Windows Norwegian locale.
Previous Message Noah Misch 2015-01-16 06:29:48 pgsql: Update "pg_regress --no-locale" for Darwin and Windows.

Browse pgsql-hackers by date

  From Date Subject
Next Message Heikki Linnakangas 2015-01-16 11:31:10 Re: More Norwegian trouble
Previous Message Dave Cramer 2015-01-16 10:43:44 Re: orangutan seizes up during isolation-check