Re: float formating with xx.00

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Dann Corbit" <DCorbit(at)connx(dot)com>
Cc: map(at)inter-resa(dot)com, pgsql-general(at)postgresql(dot)org
Subject: Re: float formating with xx.00
Date: 2003-07-04 01:32:47
Message-ID: 9144.1057282367@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

"Dann Corbit" <DCorbit(at)connx(dot)com> writes:
>> Thanks... but will a numeric data type for money display the
>> same output as
>> the input? Ex.: I enter, 19.1 will it show 19.10 or 19.1 ?

> If you are saying that you want the program to 'remember' exactly what
> you typed in and use that, then you are stuck with strings.

No, actually a column declared "numeric" (without any specific
precision) will do that for him. This is a better choice than
using a string IMHO.

regression=# select '123.45'::numeric;
numeric
---------
123.45
(1 row)

regression=# select '123.4'::numeric;
numeric
---------
123.4
(1 row)

regression=# select '123.0'::numeric;
numeric
---------
123.0
(1 row)

Not SQL-spec AFAIR, but Postgres will take it.

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Dann Corbit 2003-07-04 03:09:21 Re: float formating with xx.00
Previous Message Dann Corbit 2003-07-04 01:14:33 Re: float formating with xx.00