Skip site navigation (1) Skip section navigation (2)

Re: [COMMITTERS] pgsql: Replace empty locale name with implied value in CREATE DATABASE

From: Stefan Kaltenbrunner <stefan(at)kaltenbrunner(dot)cc>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [COMMITTERS] pgsql: Replace empty locale name with implied value in CREATE DATABASE
Date: 2012-03-26 08:05:39
Message-ID: 4F702353.1090901@kaltenbrunner.cc (view raw or flat)
Thread:
Lists: pgsql-committerspgsql-hackers
On 03/26/2012 03:47 AM, Tom Lane wrote:
> Replace empty locale name with implied value in CREATE DATABASE and initdb.
> 
> setlocale() accepts locale name "" as meaning "the locale specified by the
> process's environment variables".  Historically we've accepted that for
> Postgres' locale settings, too.  However, it's fairly unsafe to store an
> empty string in a new database's pg_database.datcollate or datctype fields,
> because then the interpretation could vary across postmaster restarts,
> possibly resulting in index corruption and other unpleasantness.
> 
> Instead, we should expand "" to whatever it means at the moment of calling
> CREATE DATABASE, which we can do by saving the value returned by
> setlocale().
> 
> For consistency, make initdb set up the initial lc_xxx parameter values the
> same way.  initdb was already doing the right thing for empty locale names,
> but it did not replace non-empty names with setlocale results.  On a
> platform where setlocale chooses to canonicalize the spellings of locale
> names, this would result in annoying inconsistency.  (It seems that popular
> implementations of setlocale don't do such canonicalization, which is a
> pity, but the POSIX spec certainly allows it to be done.)  The same risk
> of inconsistency leads me to not venture back-patching this, although it
> could certainly be seen as a longstanding bug.
> 
> Per report from Jeff Davis, though this is not his proposed patch.

hmm seems like this commit broken quagga:


http://www.pgbuildfarm.org/cgi-bin/show_log.pl?nm=quagga&dt=2012-03-26%2002%3A03%3A04


Stefan

In response to

Responses

pgsql-hackers by date

Next:From: Kyotaro HORIGUCHIDate: 2012-03-26 08:54:46
Subject: Re: Speed dblink using alternate libpq tuple storage
Previous:From: Jeff DavisDate: 2012-03-26 07:14:36
Subject: Re: pg_terminate_backend for same-role

pgsql-committers by date

Next:From: Tom LaneDate: 2012-03-26 14:29:32
Subject: Re: Re: [COMMITTERS] pgsql: Replace empty locale name with implied value in CREATE DATABASE
Previous:From: Tom LaneDate: 2012-03-26 03:18:09
Subject: pgsql: Fix COPY FROM for null marker strings that correspond toinvalid

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group