Re: Localization problems - Mailing list pgsql-general

From Karel Zak
Subject Re: Localization problems
Date
Msg-id 20011123154554.D4012@zf.jcu.cz
Whole thread Raw
In response to Localization problems  ("kucol" <kucol_the_green@poczta.onet.pl>)
List pgsql-general
On Wed, Nov 21, 2001 at 12:06:11PM +0100, kucol wrote:
> Hi,
> I've problems with polish localization in 7.1.3 database on RedHat7. I have
> system locales in proper folders. I builded postgreSQL with "enable-locale"
> parameter and before initializing database I've set variables LC_COLLATE,
> LC_NUMERIC itd.
> It all seems to be all right but after connecting to database and inserting
> some into it I've found that MONEY type is in USD, decimals are separated
> with '.' not ',' in NUMERIC type and varchar sort order is not correct. So
> it looks like localization doesn't work properly.
> How can I check if it is installed properly and maybe I am doing someting
> wrong.

 The PostgreSQL ignore LC_NUMERIC setting, because parser and other
 stuff depend on numbers format in strings. The solution is use
 to_char(). For example Czech locales:

 (L=currentcy symbol, G=group separator, D=decimal point)

test=# SELECT to_char(1452.456, 'L9G999D999');
    to_char
--------------
 Kč 1 452,456
 (1 row)


 See docs, section "Formatting functions".

        Karel

--
 Karel Zak  <zakkr@zf.jcu.cz>
 http://home.zf.jcu.cz/~zakkr/

 C, PostgreSQL, PHP, WWW, http://docs.linux.cz, http://mape.jcu.cz

pgsql-general by date:

Previous
From: Jarmo Paavilainen
Date:
Subject: Re: rollback question
Next
From: tony
Date:
Subject: Re: Ultradev and PostgreSQL on SuSE