Re: decimal seperator

From: Andreas Kretschmer <akretschmer(at)spamfence(dot)net>
To: pgsql-novice(at)postgresql(dot)org
Subject: Re: decimal seperator
Date: 2011-01-05 15:43:46
Message-ID: 20110105154346.GA7983@tux
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Jasmin Dizdarevic <jasmin(dot)dizdarevic(at)gmail(dot)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°

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Mladen Gogala 2011-01-05 16:09:19 Re: decimal seperator
Previous Message Susanne Ebrecht 2011-01-05 07:50:22 Re: decimal seperator