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_17_STABLE

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

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

Reply via email to