summaryrefslogtreecommitdiff
path: root/contrib/jsonb_plperl/jsonb_plperl.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2020-07-22 19:19:44 -0400
committerTom Lane <tgl@sss.pgh.pa.us>2020-07-22 19:19:44 -0400
commita57d312a7706321d850faa048a562a0c0c01b835 (patch)
treea70d8fb04fb1ab59b7cc76072e59dd2be02e1021 /contrib/jsonb_plperl/jsonb_plperl.c
parent9e108984fb35d8f9e2c2bffa10c0034f9161e802 (diff)
downloadpostgresql-a57d312a7706321d850faa048a562a0c0c01b835.tar.gz
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
Diffstat (limited to 'contrib/jsonb_plperl/jsonb_plperl.c')
-rw-r--r--contrib/jsonb_plperl/jsonb_plperl.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/contrib/jsonb_plperl/jsonb_plperl.c b/contrib/jsonb_plperl/jsonb_plperl.c
index ed361efbe2..b81ba54b80 100644
--- a/contrib/jsonb_plperl/jsonb_plperl.c
+++ b/contrib/jsonb_plperl/jsonb_plperl.c
@@ -227,10 +227,8 @@ SV_to_JsonbValue(SV *in, JsonbParseState **jsonb_state, bool is_elem)
/*
* jsonb doesn't allow infinity or NaN (per JSON
* specification), but the numeric type that is used for the
- * storage accepts NaN, so we have to prevent it here
- * explicitly. We don't really have to check for isinf()
- * here, as numeric doesn't allow it and it would be caught
- * later, but it makes for a nicer error message.
+ * storage accepts those, so we have to reject them here
+ * explicitly.
*/
if (isinf(nval))
ereport(ERROR,