Thread: Output Bug of pg_createcluster depending the used locale
Howdy, i think i found a minor problem with pg_createcluster. First my postgresql-common version: ii postgresql-common 142.pgdg60+1 Environment/locales: # locale LANG=en_US.UTF-8 LANGUAGE= LC_CTYPE="en_US.UTF-8" LC_NUMERIC="en_US.UTF-8" LC_TIME="en_US.UTF-8" LC_COLLATE="en_US.UTF-8" LC_MONETARY="en_US.UTF-8" LC_MESSAGES="en_US.UTF-8" LC_PAPER="en_US.UTF-8" LC_NAME="en_US.UTF-8" LC_ADDRESS="en_US.UTF-8" LC_TELEPHONE="en_US.UTF-8" LC_MEASUREMENT="en_US.UTF-8" LC_IDENTIFICATION="en_US.UTF-8" LC_ALL= Using the following command: # pg_createcluster -d /data/shared-hosting/9.0 -e UTF-8 --locale=de_DE.UTF-8 9.0 shared-hosting Creating new cluster 9.0/shared-hosting ... config /etc/postgresql/9.0/shared-hosting data /data/shared-hosting/9.0 locale en_US.UTF-8 port 5432 It prints "locale en_US.UTF-8" but i want "--locale=de_DE.UTF-8". Checking the cluster it hast the german locale, so it seems to be just an output bug? Best regards, Patryk Kordylewski XING: http://xing.to/patryk_kordylewski JOBS: http://www.imos.net/jobs -- imos Gesellschaft fuer Internet-Marketing und Online-Services mbH Alfons-Feifel-Str. 9 // D-73037 Goeppingen // Stauferpark Ost Tel: 07161 93339-17 // Fax: 07161 93339-99 // Internet: www.imos.net Eingetragen im Handelsregister des Amtsgerichts Ulm, HRB 532571 Vertreten durch die Geschäftsfuehrer Alfred und Rolf Wallender
Attachment
Patryk, On 05/17/2013 11:38 AM, Patryk Kordylewski wrote: > Checking the cluster it hast the german locale, so it seems to be just > an output bug? Looks like it, yes. At least my testing confirms this. The attached, very simple patch fixes this. Regards Markus Wanner
Attachment
Re: Markus Wanner 2013-05-17 <51960ADC.3080901@bluegap.ch> > Patryk, > > On 05/17/2013 11:38 AM, Patryk Kordylewski wrote: > > Checking the cluster it hast the german locale, so it seems to be just > > an output bug? > > Looks like it, yes. At least my testing confirms this. The attached, > very simple patch fixes this. Yeah I had also spotted this. The script isn't smart enough. > + if ($locale) { > + print " locale $locale (custom)\n"; Not sure if that's enough and we don't need to look at the encoding or lc_* values too. Possibly we could into the cluster created to figure out the values (postgresql.conf maybe?). Christoph -- cb@df7cb.de | http://www.df7cb.de/
Attachment
On 05/21/2013 05:50 AM, Christoph Berg wrote: > Not sure if that's enough and we don't need to look at the encoding or > lc_* values too. Possibly we could into the cluster created to figure > out the values (postgresql.conf maybe?). I guess it depends on what you intend to display there. Thinking of pg_createcluster as a simple wrapper around initdb, I made it fit what's getting passed to initdb. In turn, trusting that to do the Right Thing (tm) - i.e. use a specific locale when explicitly given one. Or complain if locale and encoding don't match. Or if it's given nonsense entirely, i.e.: > # ./pg_createcluster --locale foo_BAR 9.2 baz > Creating new cluster 9.2/baz ... > config /etc/postgresql/9.2/baz > data /var/lib/postgresql/9.2/baz > locale foo_BAR (custom) > initdb: invalid locale name "foo_BAR" > initdb: invalid locale name "foo_BAR" > initdb: invalid locale name "foo_BAR" > initdb: invalid locale name "foo_BAR" > initdb: invalid locale name "foo_BAR" > initdb: invalid locale name "foo_BAR" > port 5435 However, it's worth noting that initdb itself is more verbose, i.e.: > # /usr/lib/postgresql/9.2/bin/initdb -D /tmp/testdb --locale de_CH.ISO-8859-1 --encoding Latin-1 --lc-monetary de_DE.UTF-8 > The files belonging to this database system will be owned by user "postgres". > This user must also own the server process. > > The database cluster will be initialized with locales > COLLATE: de_CH.ISO-8859-1 > CTYPE: de_CH.ISO-8859-1 > MESSAGES: de_CH.ISO-8859-1 > MONETARY: de_DE.UTF-8 > NUMERIC: de_CH.ISO-8859-1 > TIME: de_CH.ISO-8859-1 > The default text search configuration will be set to "german". > ... vs: > # pg_createcluster --locale de_CH --encoding Latin-1 --lc-monetary de_DE.UTF-8 9.2 foo > Creating new cluster 9.2/foo ... > config /etc/postgresql/9.2/foo > data /var/lib/postgresql/9.2/foo > locale de_CH > port 5435 initdb emits useful information that pg_createcluster shouldn't hide, IMO. Especially in case the user manually specifies locale(s) and/or encoding. Of course, we could try to figure this out after the fact. However, initdb itself reporting what it uses seems the most reliable to me. While I see little use and justification in cross-checking initdb. Regards Markus Wanner