Обсуждение: pgsql: Support infinity and -infinity in the numeric data type.

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

pgsql: Support infinity and -infinity in the numeric data type.

От
Tom Lane
Дата:
Support infinity and -infinity in the numeric data type.

Add infinities that behave the same as they do in the floating-point
data types.  Aside from any intrinsic usefulness these may have,
this closes an important gap in our ability to convert floating
values to numeric and/or replace float-based APIs with numeric.

The new values are represented by bit patterns that were formerly
not used (although old code probably would take them for NaNs).
So there shouldn't be any pg_upgrade hazard.

Patch by me, reviewed by Dean Rasheed and Andrew Gierth

Discussion: https://postgr.es/m/606717.1591924582@sss.pgh.pa.us

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/a57d312a7706321d850faa048a562a0c0c01b835

Modified Files
--------------
contrib/jsonb_plperl/jsonb_plperl.c      |    6 +-
contrib/jsonb_plpython/jsonb_plpython.c  |    9 +-
doc/src/sgml/datatype.sgml               |   75 +-
src/backend/utils/adt/formatting.c       |    9 +-
src/backend/utils/adt/numeric.c          | 1474 +++++++++++++++++++++++-------
src/include/utils/numeric.h              |    1 +
src/test/regress/expected/aggregates.out |   86 +-
src/test/regress/expected/numeric.out    |  680 +++++++++++++-
src/test/regress/expected/window.out     |   66 +-
src/test/regress/sql/aggregates.sql      |   22 +-
src/test/regress/sql/numeric.sql         |  187 +++-
src/test/regress/sql/window.sql          |   16 +-
12 files changed, 2251 insertions(+), 380 deletions(-)