Re: to_char(0,'FM999.99') outputs 0.

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Andrew <sav(at)tut(dot)by>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: to_char(0,'FM999.99') outputs 0.
Date: 2002-09-03 17:01:26
Message-ID: 200209031701.g83H1Qu23014@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


I can see no reason that there is a period after 0 but not after 1.
Sure looks like a bug to me. Added to TODO:

* to_char(0,'FM999.99') returns a period, to_char(1,'FM999.99') does not

---------------------------------------------------------------------------

Andrew wrote:
> Hi All,
> I know this question has already been here but still...
>
> select to_char(1,'FM999.99')
> 1
>
> select to_char(0,'FM999.99')
> 0.
>
> and now I want to get rid of that trailing point !
> if this bug hasn't been fixed yet, then what is the best workaround?
> should I say something like this:
>
> select case when n = 0 then '0' else to_char(n,'FM999.99') end
>
> Good luck!
> Andrew Surinov
>
> ---------------------------(end of broadcast)---------------------------
> TIP 6: Have you searched our list archives?
>
> http://archives.postgresql.org
>

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Dan Ostrowski 2002-09-03 17:02:01 Re: [PHP] Info into Class
Previous Message Joe Conway 2002-09-03 16:40:05 Re: parameterized views?