Re: Numeric Data Type Rounding Up - Mailing list pgsql-novice

From Tom Lane
Subject Re: Numeric Data Type Rounding Up
Date
Msg-id 9943.1331140462@sss.pgh.pa.us
Whole thread Raw
In response to Numeric Data Type Rounding Up  (Carlos Mennens <carlos.mennens@gmail.com>)
Responses Re: Numeric Data Type Rounding Up  (Carlos Mennens <carlos.mennens@gmail.com>)
List 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 by date:

Previous
From: Carlos Mennens
Date:
Subject: Numeric Data Type Rounding Up
Next
From: Carlos Mennens
Date:
Subject: Re: Numeric Data Type Rounding Up