Re: How to find correct locale name for CREATEDATABASE - Mailing list pgsql-general

From Andrus
Subject Re: How to find correct locale name for CREATEDATABASE
Date
Msg-id B0AE1C0DA3F3404EA598F73E3DC7164C@andrusnotebook
Whole thread Raw
In response to Re: How to find correct locale name for CREATEDATABASE  (Alban Hertroys <dalroi@solfertje.student.utwente.nl>)
List 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.


pgsql-general by date:

Previous
From:
Date:
Subject: Re: Looking for auto starting procedures
Next
From: Scott Ribe
Date:
Subject: Re: Looking for auto starting procedures