From: | Michael Glaesemann <grzm(at)seespotcode(dot)net> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | Chris Travers <chris(at)travelamericas(dot)com>, pgsql-general <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: Localization trouble |
Date: | 2007-07-06 15:46:06 |
Message-ID: | 210CD378-A352-40E2-85BD-8EAF01355232@seespotcode.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Jul 5, 2007, at 20:59 , Tom Lane wrote:
> Michael Glaesemann <grzm(at)seespotcode(dot)net> writes:
>> I think display depends on whether or not you configured Postgres
>> with or without --enable-nls.
>
> No, to_char understands numeric locales regardless of enable-nls.
> There is no provision for locale-dependent output from a plain
> numeric column; you must use to_char.
The to_char results I could see from my tests. I was thinking that
perhaps if NLS was enabled, numeric results in, for example, psql
would be displayed even without using to_char. However, I can't seem
to coax the server to give me results in that way. Perhaps I'm just
doing it wrong.
postgres=# \d lc_examples_view
View "public.lc_examples_view"
Column | Type | Modifiers
-------------------+---------+-----------
a_money | money |
a_numeric | numeric |
a_numeric_as_text | text |
View definition:
SELECT lc_examples.a_money, lc_examples.a_numeric, to_char
(lc_examples.a_numeric, '999D99S'::text) AS a_numeric_as_text
FROM lc_examples;
postgres=# select * from lc_examples_view ;
a_money | a_numeric | a_numeric_as_text
---------+-----------+-------------------
$1.23 | 1.23 | 1.23+
(1 row)
postgres=# set lc_numeric to 'es_ES'; set lc_monetary to 'es_ES';
SET
SET
postgres=# select * from lc_examples_view ;
a_money | a_numeric | a_numeric_as_text
---------+-----------+-------------------
Eu1,23 | 1.23 | 1,23+
(1 row)
Just to clarify, I was thinking that perhaps the a_numeric column
would show a result of 1,23 since lc_numeric was set to es_ES. After
testing with --enable-nls, I see that's not the case.
Michael Glaesemann
grzm seespotcode net
From | Date | Subject | |
---|---|---|---|
Next Message | Robert Treat | 2007-07-06 15:46:52 | Re: [pgsql-general] In memory tables/databases |
Previous Message | David Fetter | 2007-07-06 15:36:29 | Re: Polymorphic delete help needed |