Re: File not found error on creating collation

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Marti Raudsepp <marti(at)juffo(dot)org>, Thom Brown <thom(at)linux(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: File not found error on creating collation
Date: 2011-09-20 03:43:00
Message-ID: CA+Tgmoag5+6-U9y=huatO-Zj1u37UqR=0_peTiQqKQCh6krAGQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Sep 19, 2011 at 10:04 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> Marti Raudsepp <marti(at)juffo(dot)org> writes:
>> On Tue, Sep 20, 2011 at 03:24, Thom Brown <thom(at)linux(dot)com> wrote:
>>> ERROR:  could not create locale "sr_SB.utf8": No such file or directory
>>> It's correct in that it shouldn't be able to create the locale since
>>> it's not installed, but what file can't it find?  What is the user
>>> supposed to do with this message?
>
>> Unfortunately locales are OS-specific so there's not much universal
>> advice that Postgres could give.
>
> The reason it's doing that is that newlocale() is returning ENOENT,
> which is what it's supposed to do according to the standard:
>
>        ERRORS
>
>        The newlocale() function shall fail if:
>
>        [ENOMEM]
>        There is not enough memory available to create the locale object or load the locale data.
>        [EINVAL]
>        The category_mask contains a bit that does not correspond to a valid category.
>        [ENOENT]
>        For any of the categories in category_mask, the locale data is not available.
>
> The generic meaning of ENOENT is "file not found", and at some level
> this probably *is* a file-not-found situation, but Postgres has no way
> to know which file is missing.
>
> We could possibly add a HINT suggesting that the locale isn't installed,
> but I don't see that we could offer any useful generic advice about how
> to install it.  I'm also worried about how to phrase the hint to cover
> some other obvious possibilities, like "you fat-fingered the locale
> name".

Maybe something like this?

HINT: The operating system was unable to find any locale data for the
locale name you specified.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Pavel Stehule 2011-09-20 03:44:55 Re: Grouping Sets
Previous Message Darren Duncan 2011-09-20 03:20:39 Re: Is there really no interest in SQL Standard?