Support infinity and -infinity in the numeric data type.
authorTom Lane <tgl@sss.pgh.pa.us>
Wed, 22 Jul 2020 23:19:44 +0000 (19:19 -0400)
committerTom Lane <tgl@sss.pgh.pa.us>
Wed, 22 Jul 2020 23:19:44 +0000 (19:19 -0400)
commita57d312a7706321d850faa048a562a0c0c01b835
treea70d8fb04fb1ab59b7cc76072e59dd2be02e1021
parent9e108984fb35d8f9e2c2bffa10c0034f9161e802
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
12 files changed:
contrib/jsonb_plperl/jsonb_plperl.c
contrib/jsonb_plpython/jsonb_plpython.c
doc/src/sgml/datatype.sgml
src/backend/utils/adt/formatting.c
src/backend/utils/adt/numeric.c
src/include/utils/numeric.h
src/test/regress/expected/aggregates.out
src/test/regress/expected/numeric.out
src/test/regress/expected/window.out
src/test/regress/sql/aggregates.sql
src/test/regress/sql/numeric.sql
src/test/regress/sql/window.sql