Introduce get_numeric_infinity() and get_numeric_nan().

While it's easy and fast to produce numeric-type infinity and
NaN inside numeric.c, outside code has had to resort to messy,
rather expensive machinations if it didn't want to hardcode
assumptions about the internals of type numeric; as just seen in
3ee29a602.  We already have support functions to produce float8
infinity and NaN, so it seems reasonable to add comparable functions
for numeric.  (Other constants one might want, such as zero and one,
seem to be served adequately by int64_to_numeric().)

Use this in the code added by 3ee29a602, but only in master.
Doing so in release branches would create ABI-skew hazards
for btree_gist, and it's not worth dealing with that.

Branch
------
master

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

Modified Files
--------------
contrib/btree_gist/btree_numeric.c |  6 ------
src/backend/utils/adt/numeric.c    | 22 ++++++++++++++++++++++
src/include/utils/numeric.h        |  2 ++
3 files changed, 24 insertions(+), 6 deletions(-)

Reply via email to