[Pkg-postgresql-public] Locale sanitizing [was: Re: Changing default encoding to unicode?]

Peter Eisentraut peter_e@gmx.net
Sun, 7 Nov 2004 23:37:55 +0100


Martin Pitt wrote:
> According to initdb's manpage (of version 7.4), both the server
> locale and the default database encoding should default to the locale
> initdb runs under. So is this right?

The man page I am reading says that in 7.4 the encoding defaults to 
SQL_ASCII, which is what it actually does.

> I think we should greatly simplify the locale handling in the current
> packages, which would also make backporting unnecessary. I would like
> to completely drop the db default encoding question, and instead
> modify the locale question so that it explains that the encoding of
> the chosen locale will become the default database encoding. The
> default locale of this question should be the locale which the
> postgres user normally runs under, not 'C'.

Right.  You would only need to devise a way to match the encoding names 
provided by the locale to the encoding names used by PostgreSQL.  You 
can steal that mapping table from PG 8.0.

> Then the user can safely accept the default, it will do the right
> thing on most systems. If he chooses another locale, then the
> postgresql-startup script has just to select this choosen locale for
> the postmaster process.

Note that changing the locale requires re-initdb.