Fix overflow problems in btree_gist's gbt_numeric_penalty().

For the same reasons as in 15b3dc140, we should avoid throwing
overflow errors in the numeric opclass.  Use numeric_sub_safe(),
or numeric_sub_opt_error() in older branches, to avoid overflow of
the numeric format; and handle Inf/NaN inputs explicitly to be sure
we get desirable answers in those cases.

Author: Ewan Young <[email protected]>
Reviewed-by: Tom Lane <[email protected]>
Discussion: 
https://postgr.es/m/CAON2xHN4hdndi-b3H=x-wryrvblzcc2abmxfoqlnuba72zq...@mail.gmail.com
Backpatch-through: 15

Branch
------
REL_19_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/8efc01ba3ec8b2bd725418c3547ec75dc894ef09

Modified Files
--------------
contrib/btree_gist/btree_numeric.c      | 63 +++++++++++++++++++++++++++------
contrib/btree_gist/expected/numeric.out | 17 +++++++++
contrib/btree_gist/sql/numeric.sql      | 13 +++++++
3 files changed, 83 insertions(+), 10 deletions(-)

Reply via email to