Problem with example numeric value

Started by PG Bug reporting formabout 2 months ago2 messagesdocs
Jump to latest
#1PG Bug reporting form
noreply@postgresql.org

The following documentation comment has been logged on the website:

Page: https://www.postgresql.org/docs/18/datatype-numeric.html
Description:

In the page https://www.postgresql.org/docs/current/datatype-numeric.html it
is said that NUMERIC(2, -3) will round values to the nearest thousand and
can store values between -99000 and 99000. However, the range of values that
are allowed are -99499 to 99499 inclusive.

#2Laurenz Albe
laurenz.albe@cybertec.at
In reply to: PG Bug reporting form (#1)
Re: Problem with example numeric value

On Fri, 2026-02-06 at 10:20 +0000, PG Doc comments form wrote:

In the page https://www.postgresql.org/docs/current/datatype-numeric.html it
is said that NUMERIC(2, -3) will round values to the nearest thousand and
can store values between -99000 and 99000. However, the range of values that
are allowed are -99499 to 99499 inclusive.

test=> CREATE TABLE t (n NUMERIC(2, -3));
CREATE TABLE
test=> INSERT INTO t VALUES (99499);
INSERT 0 1
test=> TABLE t;
n
-------
99000
(1 row)

It will *store* 99000, even if you *insert* 99499.
I'd say that the documentation is correct.

Yours,
Laurenz Albe