Re: pg9.4b1: unhelpful error message when creating a collation - Mailing list pgsql-hackers

From Andres Freund
Subject Re: pg9.4b1: unhelpful error message when creating a collation
Date
Msg-id 20140525154511.GA21233@alap3.anarazel.de
Whole thread Raw
In response to pg9.4b1: unhelpful error message when creating a collation  (Fabien COELHO <coelho@cri.ensmp.fr>)
Responses Re: pg9.4b1: unhelpful error message when creating a collation  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: pg9.4b1: unhelpful error message when creating a collation  (Fabien COELHO <coelho@cri.ensmp.fr>)
List pgsql-hackers
Hi,

On 2014-05-25 09:17:24 +0200, Fabien COELHO wrote:
>   sql> CREATE COLLATION "french" (locale='fr_FR.utf8');
>   ERROR:  could not create locale "fr_FR.utf8": Success
> 
> The collation creation fails, not sure why yet. However, the "error ..
> success" message is especially unhelpful.

This seems to be a glibc bug. If a nonexistant locale has already been
asked for errno is set to 0 instead of something sensible.

Using a debugger it's possible to see that in an earlier setlocale()
call errno is set correctly, but newlocale() then fails without setting
errno. The culprit seems to be some caching in glibc's _nl_find_locale().

I am not entirely sure why it's not reliably triggered < 9.4.

Searching for that error turned up:
https://sourceware.org/bugzilla/show_bug.cgi?id=14247
https://bugzilla.redhat.com/show_bug.cgi?id=827510

The latter by Tom Lane ;). Unfortunately not much seems to have happened
since.

Except badgering the glibc guys a bit, the only thing I can think of is
to fudge errno = 0 into errno = ENOENT. Not nice.

Greetings,

Andres Freund

-- Andres Freund                       http://www.2ndQuadrant.com/PostgreSQL Development, 24x7 Support, Training &
Services



pgsql-hackers by date:

Previous
From: Heikki Linnakangas
Date:
Subject: Could not finish anti-wraparound VACUUM when stop limit is reached
Next
From: Jeff Davis
Date:
Subject: [9.5] possible fast path for pinning a page multiple times