Re: to_char(0,'FM999.99') outputs 0. - Mailing list pgsql-general

From Bruce Momjian
Subject Re: to_char(0,'FM999.99') outputs 0.
Date
Msg-id 200209031701.g83H1Qu23014@candle.pha.pa.us
Whole thread Raw
In response to to_char(0,'FM999.99') outputs 0.  (sav@tut.by (Andrew))
Responses Re: to_char(0,'FM999.99') outputs 0.  (Karel Zak <zakkr@zf.jcu.cz>)
List 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@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073

pgsql-general by date:

Previous
From: Joe Conway
Date:
Subject: Re: parameterized views?
Next
From: Bruce Momjian
Date:
Subject: Re: Where can I find more information of XML support in PostgreSQL?