Re: Localization trouble

From: Michael Glaesemann <grzm(at)seespotcode(dot)net>
To: Chris Travers <chris(at)travelamericas(dot)com>
Cc: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: Localization trouble
Date: 2007-07-06 00:47:38
Message-ID: 34CC39FD-E921-4B30-8926-77D442185D06@seespotcode.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Michael Fuhr 2007-07-06 00:48:55 Re: Localization trouble
Previous Message Chris Travers 2007-07-06 00:10:57 Localization trouble