Skip site navigation (1) Skip section navigation (2)

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 (view raw, whole thread or download thread mbox)
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');
(1 Zeile)

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

It works also for the group separator:

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

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

> Can this be adjusted per session?

Sure ;-)

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

pgsql-novice by date

Next:From: Mladen GogalaDate: 2011-01-05 16:09:19
Subject: Re: decimal seperator
Previous:From: Susanne EbrechtDate: 2011-01-05 07:50:22
Subject: Re: decimal seperator

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group