Re: Numeric field quirk [Again]

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Matthew Hagerty <matthew(at)venux(dot)net>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Numeric field quirk [Again]
Date: 2000-10-05 06:02:42
Message-ID: 27992.970725762@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Matthew Hagerty <matthew(at)venux(dot)net> writes:
> Well, it seems that the numeric issue I was having has nothing to do with
> the precision and scale being set the same, it has to do with the input
> data. The precision has to be at least 2 greater than the biggest number
> you need to enter, i.e.

> equinox=# create table test ( d numeric(4,2) );
> CREATE
> equinox=# insert into test values(10);
> INSERT 167844 1
> equinox=# insert into test values(101);
> ERROR: overflow on numeric ABS(value) >= 10^2 for field with precision 4
> scale 2

Precision is the total number of digits, scale is the number of digits
to the right of the decimal point. So the above (4,2) means numbers
like XX.XX --- and obviously 10 fits, 101 doesn't. Your previous
example of (3,3) means numbers like .XXX --- no integer will fit,
but fractions will. I see no bug here...

regards, tom lane

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Jan Wieck 2000-10-05 08:44:08 Re: Numeric field quirk [Again]
Previous Message Matthew Hagerty 2000-10-05 03:57:45 Numeric field quirk [Again]