Re: numeric to text (7.3) - Mailing list pgsql-hackers

From Szima Gábor
Subject Re: numeric to text (7.3)
Date
Msg-id Pine.LNX.4.50.0212022047270.913-100000@vigo.sygma.net
Whole thread Raw
In response to Re: numeric to text (7.3)  (Rod Taylor <rbt@rbt.ca>)
List pgsql-hackers
On Mon, 2 Dec 2002, Rod Taylor wrote:

>  double precision | pg_catalog | round          | double precision
>  numeric          | pg_catalog | round          | numeric
>  numeric          | pg_catalog | round          | numeric, integer
>
> Looks like round still exists to me.

Rod, you don't understand me. :)

I needn't round, or the valueless zeroes too.

It's good (in older version of pSQL):
2.000::numeric -> 2
2.001::numeric -> 2.001


It's "ugly" (in 7.3):
2.000::numeric -> 2.000
2.001::numeric -> 2.001
or
round(2.000::numeric,2) -> 2.00
round(2.001::numeric,2) -> 2.00


Joel had got a good idea:

joel@joel=# select rtrim(rtrim('2.000'::numeric, '0'),'.');rtrim
-------2
(1 row)

.. but i prefer the old text(numeric) function :)


Thanks!

                        -Sygma


pgsql-hackers by date:

Previous
From: Szima Gábor
Date:
Subject: Re: numeric to text (7.3)
Next
From: "Christopher Kings-Lynne"
Date:
Subject: Re: Backend crash with tsearch