summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorHeikki Linnakangas <heikki.linnakangas@iki.fi>2015-01-16 12:12:49 +0200
committerHeikki Linnakangas <heikki.linnakangas@iki.fi>2015-01-16 13:10:06 +0200
commit2049a7d82920e23c37f92ece0051835a5ba39eeb (patch)
treed32ecd0b40a905bc8b6b24e4060d3acce02805a8 /src
parenta10de352be874ae28ea87aca79be4a5a2f229bb6 (diff)
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).
Diffstat (limited to 'src')
-rw-r--r--src/port/win32setlocale.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/port/win32setlocale.c b/src/port/win32setlocale.c
index 386750d8914..1c30997a68b 100644
--- a/src/port/win32setlocale.c
+++ b/src/port/win32setlocale.c
@@ -97,7 +97,7 @@ static const struct locale_map locale_map_result[] = {
* It's not clear what encoding setlocale() uses when it returns the
* locale name, so to play it safe, we search for "Norwegian (Bok*l)".
*/
- {"Norwegian (Bokm", "l)", "norwegian-bokmal"},
+ {"Norwegian (Bokm", "l)_Norway", "Norwegian_Norway"},
{NULL, NULL, NULL}
};