Re: initdb.exe changes --locale option

From: Sandeep Thakkar <sandeep(dot)thakkar(at)enterprisedb(dot)com>
To: Dave Page <dpage(at)pgadmin(dot)org>
Cc: Mike Toews <mwtoews(at)gmail(dot)com>, pgsql-bugs(at)postgresql(dot)org
Subject: Re: initdb.exe changes --locale option
Date: 2012-09-14 07:32:37
Message-ID: CANFyU979L1cQfzXYzUmGS1fnxKwowQgHBYrHXh7E8t7tQpikeg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

I think everything is covered by Mike here. "getlocales.exe" returns the
list of locales in the format "Language, Country" for most of them. and
this worked fine on 9.1, but does not work on 9.2. And if we are looking
for a workaround in installer, then as Mike suggested, we should handle it
in initcluster.vbs. (for 9.2.0)

Mike, for the corner cases that you talked about, one worked for me if we
keep the original format and do NOT replace the "," with "_".
---
c:\Program Files\PostgreSQL\9.2>bin\initdb.exe --locale="Norwegian
(Bokm�l), Norway" -D "c:\Program Files\PostgreSQL\9.2\data2"
The files belonging to this database system will be owned by user "edb".
This user must also own the server process.

The database cluster will be initialized with locale "Norwegian
(Bokm�l)_Norway.

---

For, the other two, I see the same behaviour. I'm using Win7, 32bit from
India.

Overall, we will have to test all the formats of the locales returned from
getlocals.exe and check what works with initdb.exe in 9.2.

On Fri, Sep 14, 2012 at 1:47 AM, Dave Page <dpage(at)pgadmin(dot)org> wrote:

> Sandeep, can you look into this and respond on list please? The thread
> started here:
> http://archives.postgresql.org/pgsql-bugs/2012-09/msg00083.php
>
> It sounds to me like the OS is at fault for not accepting the name it
> gives to a locale as input, and that the change to the installer would
> be a workaround rather than a fix - but I haven't had time to dig into
> it.
>
> Thanks.
>
> On Wed, Sep 12, 2012 at 4:53 PM, Mike Toews <mwtoews(at)gmail(dot)com> wrote:
> > I've found a general solution: with the locale string, replace the
> > first ", " (comma space) with "_".
> >
> > Around line 33 of initcluster.vbs, add:
> >
> > strLocale = Replace(strLocale,", ","_",1,1)
> >
> > I think it is fine to show "English, New Zealand" in the drop-down
> > menu for the GUI installer, but initcluster.vbs needs to do the
> > replacement to "English_New Zealand" in order to fulfil the correct
> > initialisation.
> >
> > My testing was conducted using a Python script
> http://pastebin.com/9epyWz7x
> > which produces a tab delimited table of input locales, and the locale
> > chosen by initdb.exe, as well as the default language for text search
> > configuration.
> >
> > The results from 200 locales shows some significant problems with
> > locale detection, such that most "Language, Country" are substituted
> > with only one country (you will pick up the pattern if you look at the
> > data). Secondly, there are cases that are completely off: "Tamazight
> > (Latin), Algeria" : "English_United Kingdom.1252", which is corrected
> > to "Tamazight (Latin)_Algeria.1252" with the proper substitution.
> >
> > However, there are three corner cases (of 200) that either sort-of
> > breaks things, or doesn't resolve anything:
> >
> > Original: Chinese (Traditional), Macao S.A.R. : Chinese
> (Traditional)_Taiwan.950
> > Replaced: Chinese (Traditional)_Macao S.A.R. : English_United
> Kingdom.1252
> >
> > Original: Lao, Lao P.D.R. : Lao_Lao P.D.R..1252
> > Replaced: Lao_Lao P.D.R. : English_United Kingdom.1252
> >
> > Original: Norwegian (Bokmål), Norway : English_United Kingdom.1252
> > Replaced: Norwegian (Bokmål)_Norway : English_United Kingdom.1252
> >
> > (Note: I'm testing on a Windows Vista computer from the UK)
> >
> > Lastly, I had a look at the source code initdb.c, which appears to
> > assume only POSIX locale of the format:
> > [language[_territory][(dot)codeset][(at)modifier]]
> >
> > E.g., see find_matching_ts_config, which assumes this locale format:
> >
> http://git.postgresql.org/gitweb/?p=postgresql.git;a=blob;f=src/bin/initdb/initdb.c;h=824c7fa7e4c76e0a3b8204ce0cdd21564f23d5df;hb=HEAD#l886
> >
> > It should probably handle the WIN32 logic separately from POSIX
> > locales, but that's a deeper matter.
> >
> > -Mike
> >
> >
> > --
> > Sent via pgsql-bugs mailing list (pgsql-bugs(at)postgresql(dot)org)
> > To make changes to your subscription:
> > http://www.postgresql.org/mailpref/pgsql-bugs
>
>
>
> --
> Dave Page
> Blog: http://pgsnake.blogspot.com
> Twitter: @pgsnake
>
> EnterpriseDB UK: http://www.enterprisedb.com
> The Enterprise PostgreSQL Company
>

--
Sandeep Thakkar
Senior Software Engineer
EnterpriseDB Corporation
The Enterprise Postgres Company
Phone: +91.20.30589514

Website: www.enterprisedb.com
EnterpriseDB Blog: http://blogs.enterprisedb.com/
Follow us on Twitter: http://www.twitter.com/enterprisedb

This e-mail message (and any attachment) is intended for the use of the
individual or entity to whom it is addressed. This message contains
information from EnterpriseDB Corporation that may be privileged,
confidential, or exempt from disclosure under applicable law. If you are
not the intended recipient or authorized to receive this for the intended
recipient, any use, dissemination, distribution, retention, archiving, or
copying of this communication is strictly prohibited. If you have received
this e-mail in error, please notify the sender immediately by reply e-mail
and delete this message.

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Marko Tiikkaja 2012-09-14 08:03:12 Re: BUG #7516: PL/Perl crash
Previous Message Amit Kapila 2012-09-14 03:21:38 Re: BUG #7533: Client is not able to connect cascade standby incase basebackup is taken from hot standby