Re: Localization problems

From: Karel Zak <zakkr(at)zf(dot)jcu(dot)cz>
To: kucol <kucol_the_green(at)poczta(dot)onet(dot)pl>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Localization problems
Date: 2001-11-23 14:45:55
Message-ID: 20011123154554.D4012@zf.jcu.cz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)zf(dot)jcu(dot)cz>
http://home.zf.jcu.cz/~zakkr/

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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Antonio Fiol Bonnín 2001-11-23 14:48:45 Re: Odd query behavior...
Previous Message Jarmo Paavilainen 2001-11-23 14:26:23 Re: Odd query behavior...