Thread: Create collation incorrect error code

Create collation incorrect error code

From
Magnus Hagander
Date:
Strangeness:

template1=# create collation "nb_NO.utf8" (locale=nb_NO.utf8);
ERROR:  could not create locale "nb_no.utf8": Success

Clearly it's not successful...

On some runs, I get:

template1=# create collation "nb_NO.utf8" (locale=nb_NO.utf8);
ERROR:  could not create locale "nb_no.utf8": No such file or directory
DETAIL:  The operating system could not find any locale data for the
locale name "nb_no.utf8".

Which is correct.

The first one is clearly wrong. Seems there are some cases where errno
isn't set properly? But form what I can tell
(http://pubs.opengroup.org/onlinepubs/9699919799/functions/newlocale.html)
errno should be set.


--
 Magnus Hagander
 Me: http://www.hagander.net/
 Work: http://www.redpill-linpro.com/


Re: Create collation incorrect error code

From
Tom Lane
Date:
Magnus Hagander <magnus@hagander.net> writes:
> template1=# create collation "nb_NO.utf8" (locale=nb_NO.utf8);
> ERROR:  could not create locale "nb_no.utf8": Success

What platform?
        regards, tom lane


Re: Create collation incorrect error code

From
Magnus Hagander
Date:
On Thu, May 31, 2012 at 8:16 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> Magnus Hagander <magnus@hagander.net> writes:
>> template1=# create collation "nb_NO.utf8" (locale=nb_NO.utf8);
>> ERROR:  could not create locale "nb_no.utf8": Success
>
> What platform?

D'uh, sorry.

Ubuntu 12.04.


--
 Magnus Hagander
 Me: http://www.hagander.net/
 Work: http://www.redpill-linpro.com/


Re: Create collation incorrect error code

From
Tom Lane
Date:
Magnus Hagander <magnus@hagander.net> writes:
> On Thu, May 31, 2012 at 8:16 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> What platform?

> Ubuntu 12.04.

FWIW, I get the same on Fedora 16.  It works if I say
locale='nb_NO.utf8' to prevent case-folding, so apparently case of the
locale name has something to do with it ...
        regards, tom lane


Re: Create collation incorrect error code

From
Tom Lane
Date:
I wrote:
> Magnus Hagander <magnus@hagander.net> writes:
>> On Thu, May 31, 2012 at 8:16 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>>> What platform?

>> Ubuntu 12.04.

> FWIW, I get the same on Fedora 16.

This seems to be a glibc bug: it won't set errno correctly
if you've already asked about the same wrong locale name.  Filed at
https://bugzilla.redhat.com/show_bug.cgi?id=827510
        regards, tom lane