numeric field overflow - Mailing list pgsql-general

From Nurzhan Kirbassov
Subject numeric field overflow
Date
Msg-id 8565cc8b0910052320n11e95cfcj310667bf58434482@mail.gmail.com
Whole thread Raw
Responses Re: numeric field overflow
Re: numeric field overflow
Re: numeric field overflow
Re: numeric field overflow
List 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.

pgsql-general by date:

Previous
From: Yadisnel Galvez Velazquez
Date:
Subject: Triggers and SQL
Next
From: Christophe Pettus
Date:
Subject: Re: numeric field overflow