Re: Localization trouble - Mailing list pgsql-general

From Michael Glaesemann
Subject Re: Localization trouble
Date
Msg-id 34CC39FD-E921-4B30-8926-77D442185D06@seespotcode.net
Whole thread Raw
In response to Localization trouble  (Chris Travers <chris@travelamericas.com>)
Responses Re: Localization trouble  (Michael Glaesemann <grzm@seespotcode.net>)
List pgsql-general
On Jul 5, 2007, at 19:10 , Chris Travers wrote:

> I have been trying to use set lc_numeric = various country codes
> (for example es_EC), but I am not able to get the format to change
> from 1.00 to 1,00.
> Any hints as to what I could be doing wrong?

Does this correspond to what you're seeing?

test=# CREATE TABLE lc_examples (a_money money not null, a_numeric
numeric not null);
CREATE TABLE
test=# INSERT INTO lc_examples (a_money, a_numeric) VALUES ('1.32',
-1.32);
INSERT 0 1
test=# CREATE VIEW lc_examples_view AS
SELECT a_money
        , a_numeric
        , to_char(a_numeric, '999D99S') as a_formatted_numeric
FROM lc_examples;
CREATE VIEW
test=# SELECT * FROM lc_examples_view;
a_money | a_numeric | a_formatted_numeric
---------+-----------+---------------------
    $1.32 |     -1.32 |   1.32-
(1 row)

test=# SHOW lc_monetary;
lc_monetary
-------------
C
(1 row)

test=# SHOW lc_numeric;
lc_numeric
------------
C
(1 row)

test=# SELECT * FROM lc_examples_view;
a_money | a_numeric | a_formatted_numeric
---------+-----------+---------------------
    $1.32 |     -1.32 |   1.32-
(1 row)

test=# SET lc_monetary TO 'es_ES';
SET
test=# SET lc_numeric TO 'es_ES';
SET
test=# SELECT * FROM lc_examples_view;
a_money | a_numeric | a_formatted_numeric
---------+-----------+---------------------
   Eu1,32 |     -1.32 |   1,32-
(1 row)

I don't believe you'll see numbers *as numbers* displayed with the
formatting you desire unless you somehow tell your client (e.g.,
psql) which locale you want to use. I haven't figured out how to do
this yet, though.

Michael Glaesemann
grzm seespotcode net



pgsql-general by date:

Previous
From: Chris Travers
Date:
Subject: Localization trouble
Next
From: Michael Fuhr
Date:
Subject: Re: Localization trouble