Re: decimal seperator - Mailing list pgsql-novice

From Andreas Kretschmer
Subject Re: decimal seperator
Date
Msg-id 20110105154346.GA7983@tux
Whole thread Raw
In response to decimal seperator  (Jasmin Dizdarevic <jasmin.dizdarevic@gmail.com>)
List pgsql-novice
Jasmin Dizdarevic <jasmin.dizdarevic@gmail.com> wrote:

> Hi,
>
> is there a way to change the way how postgresql outputs floating point numbers?

Yeah, you can and should use to_char(), example:

test=# select to_char(2.34,'999D99');
 to_char
---------
    2.34
(1 Zeile)

Zeit: 0,153 ms
test=*# set lc_numeric = 'de_DE.UTF-8';
SET
Zeit: 0,122 ms
test=*# select to_char(2.34,'999D99');
 to_char
---------
    2,34
(1 Zeile)


It works also for the group separator:

test=*# select to_char(1234567.89,'999G999G999D99');
     to_char
-----------------
    1.234.567,89


You have to use to_char(), but i think, this is exactly what you are
looking for.

>
> Can this be adjusted per session?

Sure ;-)


Andreas
--
Really, I'm not out to destroy Microsoft. That will just be a completely
unintentional side effect.                              (Linus Torvalds)
"If I was god, I would recompile penguin with --enable-fly."   (unknown)
Kaufbach, Saxony, Germany, Europe.              N 51.05082°, E 13.56889°

pgsql-novice by date:

Previous
From: Susanne Ebrecht
Date:
Subject: Re: decimal seperator
Next
From: Mladen Gogala
Date:
Subject: Re: decimal seperator