Re: float formating with xx.00

From: Mark <map(at)inter-resa(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: float formating with xx.00
Date: 2003-07-04 03:16:52
Message-ID: 0HHH00HRGCUTE9@VL-MO-MR001.ip.videotron.ca
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On July 3, 2003 21:32 pm, Tom Lane wrote:
> "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)
>

Hello,

Thank you for this insight... but I tried to enter "20.00" into a:
foo numeric type
foo float4 type
or even a:
foo numeric(12,2) type

with the same result: a select foo::numeric from table; always gives me "20"
just like select foo from table;

In the case of numeric(12,2), I always get the trailing double digits... so
"20" entered gives "20.00" with the select foo (with or without the
::numeric).

??? Did miss something from your explanation or is it my 7.1.x version taht
is the problem?

Thanks,

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2003-07-04 03:20:35 Re: float formating with xx.00
Previous Message Dann Corbit 2003-07-04 03:09:21 Re: float formating with xx.00