Re: float formating with xx.00

Поиск
Список
Период
Сортировка
От Mark
Тема Re: float formating with xx.00
Дата
Msg-id 0HHH00HRGCUTE9@VL-MO-MR001.ip.videotron.ca
обсуждение исходный текст
Ответ на Re: float formating with xx.00  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-general
On July 3, 2003 21:32 pm, Tom Lane wrote:
> "Dann Corbit" <DCorbit@connx.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,

В списке pgsql-general по дате отправления:

Предыдущее
От: "Dann Corbit"
Дата:
Сообщение: Re: float formating with xx.00
Следующее
От: Tom Lane
Дата:
Сообщение: Re: float formating with xx.00