Re: How to find correct locale name for CREATEDATABASE - Mailing list pgsql-general
From | Alban Hertroys |
---|---|
Subject | Re: How to find correct locale name for CREATEDATABASE |
Date | |
Msg-id | D07ADF4B-B32C-48A5-97C6-F6C8D4C09CCA@solfertje.student.utwente.nl Whole thread Raw |
In response to | Re: ***SPAM*** Re: How to find correct locale name for CREATEDATABASE ("Andrus" <kobruleht2@hot.ee>) |
Responses |
Re: How to find correct locale name for CREATEDATABASE
|
List | pgsql-general |
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 responsibilityto 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 havesome "virtual tables" for available locales, logged in users, kernel tunables, etc (provided the security implicationsare taken care of properly, of course!). We just don't have them now, and I don't think any other database hassomething 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 determineavailable 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 databaseserver. But then you're suddenly talking about initdb, for which you do need shell access. You're not making a lotof 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 tocreate 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 picka different one, it probably wouldn't behave the same. Apparently you can't just use the default locales either, or youwouldn'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 theserver 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 incompatibledefault 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!
pgsql-general by date: