pg.ddx.io  pgsql-pkg-debian@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Markus Wanner <markus@bluegap.ch>
To: Christoph Berg <myon@debian.org>
To: Patryk Kordylewski <pk@imos.net>
To: pgsql-pkg-debian@postgresql.org
Subject: Re: Output Bug of pg_createcluster depending the used locale
Date: Tue, 21 May 2013 20:15:39 +0200
Message-ID: <519BB9CB.4000501@bluegap.ch> (raw)
In-Reply-To: <20130521035038.GD5255@msgid.df7cb.de>
References: <5195FA83.9010604@imos.net>
	<51960ADC.3080901@bluegap.ch>
	<20130521035038.GD5255@msgid.df7cb.de>
List-Unsubscribe:  <mailto:majordomo@postgresql.org?body=unsub%20pgsql-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

view thread (4+ messages)

Message-ID: <519BB9CB.4000501@bluegap.ch>
Permalink:  ../519BB9CB.4000501@bluegap.ch/
Also on:    postgresql.org/message-id/519BB9CB.4000501@bluegap.ch

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-pkg-debian@postgresql.org
  Cc: markus@bluegap.ch, myon@debian.org, pk@imos.net
  Subject: Re: Output Bug of pg_createcluster depending the used locale
  In-Reply-To: <519BB9CB.4000501@bluegap.ch>
  References: <5195FA83.9010604@imos.net> <51960ADC.3080901@bluegap.ch> <20130521035038.GD5255@msgid.df7cb.de> <519BB9CB.4000501@bluegap.ch>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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