numeric field overflow

From: Nurzhan Kirbassov <km(dot)sameboy(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: numeric field overflow
Date: 2009-10-06 06:20:11
Message-ID: 8565cc8b0910052320n11e95cfcj310667bf58434482@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Good day.

I may be misunderstanding the NUMERIC type description in the manual,
so can anyone please help me with this? Description says:

"The scale of a numeric is the count of decimal digits in the
fractional part, to the right of the decimal point. The precision of a
numeric is the total count of significant digits in the whole number,
that is, the number of digits to both sides of the decimal point. ...
Integers can be considered to have a scale of zero. "

However, I am not able to insert numbers that have number of digits
equal to the precision and the scale equal to 0.

F.E.:

CREATE TABLE test.test
(
rate numeric(5,1)
)

INSERT INTO test.test VALUES (10000)

Generates an error:

ERROR: numeric field overflow
SQL state: 22003
Detail: A field with precision 5, scale 1 must round to an absolute
value less than 10^4.

So, does the precision part of the numeric type really means number of
digits to the left of the decimal point, or what ?

Thanks.

--
Regards,
Nurzhan Kirbassov.

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Christophe Pettus 2009-10-06 06:26:03 Re: numeric field overflow
Previous Message Yadisnel Galvez Velazquez 2009-10-06 04:24:28 Triggers and SQL