Re: float formating with xx.00

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: float formating with xx.00
Дата
Msg-id 9144.1057282367@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: float formating with xx.00  ("Dann Corbit" <DCorbit@connx.com>)
Ответы Re: float formating with xx.00  (Mark <map@inter-resa.com>)
Список pgsql-general
"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)

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

            regards, tom lane

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

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