Create collation incorrect error code

Started by Magnus Haganderalmost 14 years ago5 messageshackers
Jump to latest
#1Magnus Hagander
magnus@hagander.net

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/

#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Magnus Hagander (#1)
Re: Create collation incorrect error code

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

#3Magnus Hagander
magnus@hagander.net
In reply to: Tom Lane (#2)
Re: Create collation incorrect error code

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/

#4Tom Lane
tgl@sss.pgh.pa.us
In reply to: Magnus Hagander (#3)
Re: Create collation incorrect error code

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

#5Tom Lane
tgl@sss.pgh.pa.us
In reply to: Tom Lane (#4)
Re: Create collation incorrect error code

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