Search Postgresql Archives

numeric field overflow

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.

-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux