pg.ddx.io  pgsql-pkg-debian@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Output Bug of pg_createcluster depending the used locale
4+ messages / 3 participants
[nested] [flat]

* Output Bug of pg_createcluster depending the used locale
@ 2013-05-17 09:38 Patryk Kordylewski <pk@imos.net>
  2013-05-17 10:47 ` Re: Output Bug of pg_createcluster depending the used locale Markus Wanner <markus@bluegap.ch>
  0 siblings, 1 reply; 4+ messages in thread

From: Patryk Kordylewski @ 2013-05-17 09:38 UTC (permalink / raw)
  To: pgsql-pkg-debian

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

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

Attachments:

pk.vcf (text/x-vcard, 179B) download begin:vcard fn:Patryk Kordylewski n:Kordylewski;Patryk email;internet:pk@imos.net tel;work:071619333917 tel;fax:071619333999 x-mozilla-html:FALSE version:2.1 end:vcard
^ permalink raw reply [nested|flat] 4+ messages in thread

* Re: Output Bug of pg_createcluster depending the used locale
  2013-05-17 09:38 Output Bug of pg_createcluster depending the used locale Patryk Kordylewski <pk@imos.net>
@ 2013-05-17 10:47 ` Markus Wanner <markus@bluegap.ch>
  2013-05-21 03:50   ` Re: Output Bug of pg_createcluster depending the used locale Christoph Berg <myon@debian.org>
  0 siblings, 1 reply; 4+ messages in thread

From: Markus Wanner @ 2013-05-17 10:47 UTC (permalink / raw)
  To: Patryk Kordylewski <pk@imos.net>; +Cc: pgsql-pkg-debian

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

Attachments:

locale-display-fix.diff (text/x-patch, 767B) download # Correctly display a custom locale, if the user specified one. --- pg_createcluster 2013-04-12 12:32:08 +0000 +++ pg_createcluster 2013-05-17 10:42:11 +0000 @@ -348,9 +348,14 @@ error "$datadir already contains a version $existingver cluster"; } } else { - my $loc = setlocale (LC_CTYPE); + my $sys_loc = setlocale (LC_CTYPE); print "Creating new cluster $version/$cluster ...\n"; - print " config $confdir\n data $datadir\n locale $loc\n"; + print " config $confdir\n data $datadir\n"; + if ($locale) { + print " locale $locale (custom)\n"; + } else { + print " locale $sys_loc (default)\n"; + } init_db $version, $datadir, $owneruid, $ownergid, \@initdb_opts_from_cli; $newcluster = 1; }
signature.asc (application/pgp-signature, 1.6K) download ^ permalink raw reply [nested|flat] 4+ messages in thread

* Re: Output Bug of pg_createcluster depending the used locale
  2013-05-17 09:38 Output Bug of pg_createcluster depending the used locale Patryk Kordylewski <pk@imos.net>
  2013-05-17 10:47 ` Re: Output Bug of pg_createcluster depending the used locale Markus Wanner <markus@bluegap.ch>
@ 2013-05-21 03:50   ` Christoph Berg <myon@debian.org>
  2013-05-21 18:15     ` Re: Output Bug of pg_createcluster depending the used locale Markus Wanner <markus@bluegap.ch>
  0 siblings, 1 reply; 4+ messages in thread

From: Christoph Berg @ 2013-05-21 03:50 UTC (permalink / raw)
  To: Markus Wanner <markus@bluegap.ch>; +Cc: Patryk Kordylewski <pk@imos.net>; pgsql-pkg-debian

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/

Attachments:

  signature.asc (application/pgp-signature, 835B) download

^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: Output Bug of pg_createcluster depending the used locale
  2013-05-17 09:38 Output Bug of pg_createcluster depending the used locale Patryk Kordylewski <pk@imos.net>
  2013-05-17 10:47 ` Re: Output Bug of pg_createcluster depending the used locale Markus Wanner <markus@bluegap.ch>
  2013-05-21 03:50   ` Re: Output Bug of pg_createcluster depending the used locale Christoph Berg <myon@debian.org>
@ 2013-05-21 18:15     ` Markus Wanner <markus@bluegap.ch>
  0 siblings, 0 replies; 4+ messages in thread

From: Markus Wanner @ 2013-05-21 18:15 UTC (permalink / raw)
  To: Christoph Berg <myon@debian.org>; Patryk Kordylewski <pk@imos.net>; pgsql-pkg-debian

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

Attachments:

  signature.asc (application/pgp-signature, 1.6K) download

^ permalink  raw  reply  [nested|flat] 4+ messages in thread


end of thread, other threads:[~2013-05-21 18:15 UTC | newest]

Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2013-05-17 09:38 Output Bug of pg_createcluster depending the used locale Patryk Kordylewski <pk@imos.net>
2013-05-17 10:47 ` Markus Wanner <markus@bluegap.ch>
2013-05-21 03:50   ` Christoph Berg <myon@debian.org>
2013-05-21 18:15     ` Markus Wanner <markus@bluegap.ch>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox