From: Jeff Davis <pgsql@j-davis.com>
To: pgsql-bugs@postgresql.org
Subject: Re: check_locale() and the empty string
Date: Mon, 12 Mar 2012 09:54:41 -0700
Message-ID: <1331571281.6425.47.camel@jdavis> (raw)
In-Reply-To: <1331490004.6425.20.camel@jdavis>
References: <1331490004.6425.20.camel@jdavis>
On Sun, 2012-03-11 at 11:20 -0700, Jeff Davis wrote:
> The problem seems to be in check_locale(), which just checks for a
> non-NULL return value from setlocale(). However, the manual for
> setlocale() says:
>
> If locale is "", each part of the locale that should be modified
> is set according to the environment variables. The details
> are implementation-dependent.
Trivial patch attached.
Regards,
Jeff Davis
Attachments:check_locale.patch (text/x-patch, 506B) download
*** a/src/backend/utils/adt/pg_locale.c
--- b/src/backend/utils/adt/pg_locale.c
***************
*** 229,234 **** check_locale(int category, const char *value)
--- 229,241 ----
char *save;
bool ret;
+ /*+ * The empty string is not a valid locale; it causes the locale to be set+ * from the environment, which is not what we want.+ */+ if (strcmp(value, "") == 0)+ return false;+
save = setlocale(category, NULL);
if (!save)
return false; /* won't happen, we hope */
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-bugs@postgresql.org
Cc: pgsql@j-davis.com
Subject: Re: check_locale() and the empty string
In-Reply-To: <1331571281.6425.47.camel@jdavis>
References: <1331490004.6425.20.camel@jdavis> <1331571281.6425.47.camel@jdavis>
* 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