Re: numeric to text (7.3)

From: Szima Gábor <sygma(at)tesla(dot)hu>
To: Rod Taylor <rbt(at)rbt(dot)ca>
Cc: Joel Burton <joel(at)joelburton(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: numeric to text (7.3)
Date: 2002-12-02 20:07:04
Message-ID: Pine.LNX.4.50.0212022047270.913-100000@vigo.sygma.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)joel=# select rtrim(rtrim('2.000'::numeric, '0'),'.');
rtrim
-------
2
(1 row)

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

Thanks!

-Sygma

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Christopher Kings-Lynne 2002-12-02 20:14:46 Re: toast table growing indefinitely? Known
Previous Message Christopher Kings-Lynne 2002-12-02 20:03:58 Re: ALTER TABLE schema SCHEMA TO new_schema?