On 2 Dec 2010, at 13:34, Andrus wrote:

>>> Because, as opposed to the developers of the projects that you're
>>> apparently familiar with, the Postgres developers have common sense ;)
> 
> intidb fallbacks to en_US locale if locale specified in command line is not
> found.

Aren't you confusing different commands now? You were talking about CREATE 
DATABASE, but now you're suddenly saying initdb.
And if you can run initdb, you can also run locale -a


Locales are an operating system matter, just like disk space usage, user names, 
cpu load, etc. A database server has no responsibility to provide such 
information - it could even lead to security issues if it did.

Not that I'm saying that a database server _couldn't_ provide such information, 
it would probably be quite useful to have some "virtual tables" for available 
locales, logged in users, kernel tunables, etc (provided the security 
implications are taken care of properly, of course!). We just don't have them 
now, and I don't think any other database has something like this either.


>>> Seriously though, functionality like that has no place in a database
>>> server. That's the responsibility of the OS, or if it lacks in that
>>> respect, for third-party tools.
> 
> Using CREATE DATABASE to determine server locale seems  not reasonable since 
> this command
> can fail for other reasons also. There is no way to know was this failing due 
> to missing locale.
> 
> What is best command to  probe postgresql 9 server for locale existence ?


You're obviously leaving out some important information, for example why you 
insist on using the database server to determine available locales. Is that 
even what you're trying to do, determine available locales?

Judging from your earlier answer that only port 5432 is open it would appear 
that you don't have shell access to the database server. But then you're 
suddenly talking about initdb, for which you do need shell access. You're not 
making a lot of sense with the little information you gave us.


Anyway, if CREATE DATABASE fails because the locale isn't available, it says so:

postgres=> CREATE DATABASE asdf LC_CTYPE 'as_DF';
ERROR:  invalid locale name as_DF

So you certainly do know why it failed.

If you indeed don't have shell access but only database access, then you're 
probably pretty much stuck with just trying to create the database and checking 
the error message.


However, if the locale that your database needs isn't available, what did you 
intend to do about that? You can't just pick a different one, it probably 
wouldn't behave the same. Apparently you can't just use the default locales 
either, or you wouldn't be asking about this.

If the locale you need isn't available on the server and you don't have shell 
access to it, then you'll have to contact the server administrators to _make_ 
the locale available.
That means that either the OS doesn't have the required locale, or the database 
cluster was initialised with an incompatible default locale - neither of these 
situations can be solved by trying CREATE DATABASE with a different locale, not 
if the locale mattered in the first place.

Alban Hertroys

--
Screwing up is an excellent way to attach something to the ceiling.


!DSPAM:737,4cf7b25e802651003785035!



-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

Reply via email to