On 2 Dec 2010, at 18:53, Andrus wrote:

>> 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.
> 
> I'm trying to create portable application which can automatically create 
> database using estonian locale in any server.
> Postgres returns different values for same locale:
> 
> In Fedora    et_EE.UTF8
> Other linuxes    et_EE.UTF-8

These are the same locales, just a differently named encoding.

> In Windows    Estonian_Estonia.1257
> In some other Linuxes something like Estonian.Estonia

What do you need the locale for in your case? Collation? Monetary values? 
Numeric representation?
Or just for encoding - which isn't part of the locale AFAIK?

> For this reason I'm looking for a way to probe server for locale existence.


I'm thinking you may be able to use your clients settings to determine the 
right locale from the database's session variables. You can, for example, "set 
lc_ctype to 'et_EE';" and verify that you get the same locale back. Or you 
could perform a simple test-query that should return a row encoded in the 
encoding you need and verify that it matches what you expect.

I can't say for certain that this will work, my database is in C locale, and 
besides, I don't think my OS supports collation. You can just try it out and 
see what you get on different systems.

Alban Hertroys

--
If you can't see the forest for the trees,
cut the trees and you'll see there is no forest.


!DSPAM:737,4cf7e5ea802651502012066!



-- 
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