Re: How to find correct locale name for CREATEDATABASE

From: "Andrus" <kobruleht2(at)hot(dot)ee>
To: "Alban Hertroys" <dalroi(at)solfertje(dot)student(dot)utwente(dot)nl>
Cc: "Craig Ringer" <craig(at)postnewspapers(dot)com(dot)au>, "Peter Eisentraut" <peter_e(at)gmx(dot)net>, "Thom Brown" <thom(at)linux(dot)com>, <pgsql-general(at)postgresql(dot)org>
Subject: Re: How to find correct locale name for CREATEDATABASE
Date: 2010-12-02 19:11:14
Message-ID: B0AE1C0DA3F3404EA598F73E3DC7164C@andrusnotebook
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

>> In Fedora et_EE.UTF8
>> Other linuxes et_EE.UTF-8
>These are the same locales, just a differently named encoding.

Postgres requires those suffixes in locale names.
They must me exactly UTF8 or UTF-8 or 1257 .
If those are missing, or even if - sign is missed in UTF-8, error occurs on

create database test lc_collate '...'

So all those invariants must be used in probing.

> What do you need the locale for in your case?

I need locale mostly for ILIKE and ORDER BY to work properly.

>Collation?

Yes.

> Monetary values?

No

> Numeric representation?

No

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

set lc_ctype to 'et_EE'

or to other value returns

parameter "lc_ctype" cannot be changed

> 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 need to know locale name to set locale.
Is there some simple command which can used to test for locale existence for
create database command ?

Andrus.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Scott Ribe 2010-12-02 19:16:29 Re: Looking for auto starting procedures
Previous Message mabra 2010-12-02 18:32:23 Re: Looking for auto starting procedures