Re: Numeric Data Type Rounding Up

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Numeric Data Type Rounding Up
Дата
Msg-id 9943.1331140462@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Numeric Data Type Rounding Up  (Carlos Mennens <carlos.mennens@gmail.com>)
Ответы Re: Numeric Data Type Rounding Up  (Carlos Mennens <carlos.mennens@gmail.com>)
Список pgsql-novice
Carlos Mennens <carlos.mennens@gmail.com> writes:
> I have a table called weight and this table is tracking weight for a
> few people in a fitness program that just started. I created the table
> as described below:

> fitness=# \d weight
> ...
>  lbs    | numeric(5,0)          | not null

> Now when I enter a value in the 'lbs' field / column of '172.80', it
> rounds the value up to '173.00'.

Well, you told it to: (5,0) says five digits before the decimal point
and none after.  Perhaps numeric(5,2) is what you were after.

            regards, tom lane

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

Предыдущее
От: Carlos Mennens
Дата:
Сообщение: Numeric Data Type Rounding Up
Следующее
От: Carlos Mennens
Дата:
Сообщение: Re: Numeric Data Type Rounding Up