[BUGS] initdb.exe changes --locale option

2012-09-10 Thread Mike Toews
I'm using the "postgresql-9.2.0-1-windows.exe" installer, from
Enterprise DB, on a Windows Vista 32-bit computer.

The issue was noticed with the GUI installer, where I chose the local
option "English, New Zealand" from a drop-down menu, but the resulting
database cluster has "English_United States.1252".

With initdb.exe, I see that --locale has unexpected behaviour. I'll
present a few examples that each represent key : value, where key is
set with --local="key" and value is from the output: The database
cluster will be initialized with locale "value".

C : C
English : English_United States.1252
French : French_France.1252
nonsense : English_United Kingdom.1252
French, Canada : French_France.1252
French_Canada : French_Canada.1252
English, Canada : English_United States.1252
English_New_Zealand : English_United Kingdom.1252
English, New Zealand : English_United States.1252
English_New Zealand : English_New Zealand.1252

There are some interesting interpretations in the above, but I
understand they probably depend on the OS (Windows Vista, in this
case). In the install-postgresql.log file I see attempts to get a list
of available system locales:


Executing 
C:\Users\mwtoews\AppData\Local\Temp\postgresql_installer\getlocales.exe
Script exit code: 0

Script output:
 AfrikaansxxCOMMASPxxSouthxxSPxxAfrica=Afrikaans, South Africa
AlbanianxxCOMMASPxxAlbania=Albanian, Albania
...
EnglishxxCOMMASPxxCanada=English, Canada
...
EnglishxxCOMMASPxxNewxxSPxxZealand=English, New Zealand
...
EnglishxxCOMMASPxxUnitedxxSPxxKingdom=English, United Kingdom
EnglishxxCOMMASPxxUnitedxxSPxxStates=English, United States
...
FrenchxxCOMMASPxxCanada=French, Canada
FrenchxxCOMMASPxxFrance=French, France


where it appears that the value after "=" is used to populate the
drop-down menu.

-Mike


-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs


Re: [BUGS] initdb.exe changes --locale option

2012-09-10 Thread Mike Toews
Furthermore, to compare with initdb.exe from 9.1 on the same computer,
here are the key : value pairs from the --locale="key" and locale
used.

>"C:\Program Files\PostgreSQL\9.1\bin\initdb.exe" --version
initdb (PostgreSQL) 9.1.4

C : C
English : English
French : French
nonsense : English_United Kingdom.1252
French, Canada : French, Canada
French_Canada : French_Canada
English, Canada : English, Canada
English_New_Zealand : English_United Kingdom.1252
English, New Zealand : English, New Zealand
English_New Zealand : English_New Zealand


-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs


Re: [BUGS] BUG #7530: initdb.exe ignores --locale option, uses "English_United States.1252"

2012-09-11 Thread Mike Toews
Apologies for multiple email threads, as this message was sent before
my other email and before adding my account to this list. This bug
report is slightly misleading, as the --locale option is not ignored
by initdb.exe, but is misinterpreted in certain cases.

See email thread: "initdb.exe changes --locale option"
http://archives.postgresql.org/pgsql-bugs/2012-09/msg00083.php

-Mike


-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs


Re: [BUGS] initdb.exe changes --locale option

2012-09-11 Thread Mike Toews
Testing on another Windows OS, here is a similar key : value exercise,
described previously. The system is Windows 7 64-bit, with a system
locale: "en-nz;English (New Zealand)" (from systeminfo.exe). The
version of initdb.exe is 9.2.0, and the full command-line is:

>"C:\Program Files\PostgreSQL\9.2\bin\initdb.exe" --locale="key" 
>--encoding=UTF-8 -D NUL

C : C
English : English_United States.1252
French : French_France.1252
nonsense : English_New Zealand.1252
displays initdb: invalid locale name "nonsense" 6 times
French, Canada : French_France.1252
French_Canada : French_Canada.1252
English, Canada : English_United States.1252
English_New_Zealand : English_New Zealand.1252
displays initdb: invalid locale name "English_New_Zealand" 6 times
English, New Zealand : English_United States.1252
English_New Zealand : English_New Zealand.1252

Interestingly, this OS displays "initdb: invalid locale name" (six
times), whereas I don't recall seeing that message with Vista. But it
doesn't tell me that "English, New Zealand" is invalid, while it
changes the locale to "English_United States.1252", which is puzzling.

-Mike


-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs


Re: [BUGS] initdb.exe changes --locale option

2012-09-12 Thread Mike Toews
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][.codeset][@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@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs


[BUGS] Mixed newlines in Windows installer files

2012-09-18 Thread Mike Toews
Apologies that this report is near trivial, and only concerns the
Windows installers by EnterpriseDB (I'm not sure where else to post
these).

With all of the current EnterpriseDB builds for Windows, several files
have inconsistent line endings, switching between so-called DOS
(CR+LF) and UNIX (LF).

scripts\serverctl.vbs
scripts\runpsql.bat
installer\server\*.vbs

With all of these files, the header looks odd, e.g., serverctl.vbs in VIM:

' Copyright (c) 2012, EnterpriseDB Corporation.  All rights reserved
On Error Resume Next^M
^M
...

or in notepad.exe (a terrible, yet default editor):

' Copyright (c) 2012, EnterpriseDB Corporation.  All rights reservedOn
Error Resume Next
...

I've found this problem with 9.2 and in recent 9.1 installer
directories, but not in older releases from a few months ago, so this
is a recent change.

(Even more nitpickier, pg_env.bat ends with lots of extra whitespace,
but no line ending.)

Note that mixed newlines do not appear to change their behaviour, but
I could be mistaken.

-Mike


-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs