Problem with example numeric value

Поиск
Список
Период
Сортировка
Искать

Problem with example numeric value

От:
PG Doc comments 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.



Re: Problem with example numeric value

От:
Laurenz Albe <laurenz.albe@cybertec.at>
Дата:
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


FAQ