]> granicus.if.org Git - postgresql/commitdiff
Remove jsonb_plperl test cases for Inf/NaN conversions.
authorTom Lane <tgl@sss.pgh.pa.us>
Tue, 1 May 2018 17:21:16 +0000 (13:21 -0400)
committerTom Lane <tgl@sss.pgh.pa.us>
Tue, 1 May 2018 17:21:16 +0000 (13:21 -0400)
It turns out that old Perl versions (before about 5.10) don't have any
very reliable way to generate Inf or NaN numeric values.  Getting around
that would require way more work than is really justified to test the
code involved, so let's just drop these new test cases.

Discussion: https://postgr.es/m/28585.1525131438@sss.pgh.pa.us

contrib/jsonb_plperl/expected/jsonb_plperl.out
contrib/jsonb_plperl/expected/jsonb_plperlu.out
contrib/jsonb_plperl/sql/jsonb_plperl.sql
contrib/jsonb_plperl/sql/jsonb_plperlu.sql

index c16d16dab4ea9be38fb0956870b0fc6404fa216e..e4f3cdd41aa9c736afe85d85cc97edbd38b95ec0 100644 (file)
@@ -39,26 +39,6 @@ SELECT testSVToJsonb();
  1
 (1 row)
 
-CREATE FUNCTION testInf() RETURNS jsonb
-LANGUAGE plperl
-TRANSFORM FOR TYPE jsonb
-AS $$
-$val = 9**9**9;  # we assume this will overflow to +Inf
-return $val;
-$$;
-SELECT testInf();
-ERROR:  cannot convert infinity to jsonb
-CONTEXT:  PL/Perl function "testinf"
-CREATE FUNCTION testNaN() RETURNS jsonb
-LANGUAGE plperl
-TRANSFORM FOR TYPE jsonb
-AS $$
-$val = sin(9**9**9);  # we assume sin(inf) will yield NaN
-return $val;
-$$;
-SELECT testNaN();
-ERROR:  cannot convert NaN to jsonb
-CONTEXT:  PL/Perl function "testnan"
 -- this revealed a bug in the original implementation
 CREATE FUNCTION testRegexpResultToJsonb() RETURNS jsonb
 LANGUAGE plperl
@@ -227,4 +207,4 @@ SELECT roundtrip('{"1": {"2": [3, 4, 5]}, "2": 3}');
 
 \set VERBOSITY terse \\ -- suppress cascade details
 DROP EXTENSION plperl CASCADE;
-NOTICE:  drop cascades to 8 other objects
+NOTICE:  drop cascades to 6 other objects
index e84ea7cf66c8339fda7eaffc20a84a0dbfc98e6c..b44995058f2fef8548474831c803b86abee80d90 100644 (file)
@@ -39,26 +39,6 @@ SELECT testSVToJsonb();
  1
 (1 row)
 
-CREATE FUNCTION testInf() RETURNS jsonb
-LANGUAGE plperlu
-TRANSFORM FOR TYPE jsonb
-AS $$
-$val = 9**9**9;  # we assume this will overflow to +Inf
-return $val;
-$$;
-SELECT testInf();
-ERROR:  cannot convert infinity to jsonb
-CONTEXT:  PL/Perl function "testinf"
-CREATE FUNCTION testNaN() RETURNS jsonb
-LANGUAGE plperlu
-TRANSFORM FOR TYPE jsonb
-AS $$
-$val = sin(9**9**9);  # we assume sin(inf) will yield NaN
-return $val;
-$$;
-SELECT testNaN();
-ERROR:  cannot convert NaN to jsonb
-CONTEXT:  PL/Perl function "testnan"
 -- this revealed a bug in the original implementation
 CREATE FUNCTION testRegexpResultToJsonb() RETURNS jsonb
 LANGUAGE plperlu
@@ -227,4 +207,4 @@ SELECT roundtrip('{"1": {"2": [3, 4, 5]}, "2": 3}');
 
 \set VERBOSITY terse \\ -- suppress cascade details
 DROP EXTENSION plperlu CASCADE;
-NOTICE:  drop cascades to 8 other objects
+NOTICE:  drop cascades to 6 other objects
index 436e18730f8b6276a764845778e9f6854ceef8de..8b0a8764afa91d4f587e639407f3647410f5c871 100644 (file)
@@ -34,28 +34,6 @@ $$;
 SELECT testSVToJsonb();
 
 
-CREATE FUNCTION testInf() RETURNS jsonb
-LANGUAGE plperl
-TRANSFORM FOR TYPE jsonb
-AS $$
-$val = 9**9**9;  # we assume this will overflow to +Inf
-return $val;
-$$;
-
-SELECT testInf();
-
-
-CREATE FUNCTION testNaN() RETURNS jsonb
-LANGUAGE plperl
-TRANSFORM FOR TYPE jsonb
-AS $$
-$val = sin(9**9**9);  # we assume sin(inf) will yield NaN
-return $val;
-$$;
-
-SELECT testNaN();
-
-
 -- this revealed a bug in the original implementation
 CREATE FUNCTION testRegexpResultToJsonb() RETURNS jsonb
 LANGUAGE plperl
index 339486ddb6f52cf09abf25c2e707802331e9073c..9287f7672f76ff95ef3527d55c54a25d3cd6a7d2 100644 (file)
@@ -34,28 +34,6 @@ $$;
 SELECT testSVToJsonb();
 
 
-CREATE FUNCTION testInf() RETURNS jsonb
-LANGUAGE plperlu
-TRANSFORM FOR TYPE jsonb
-AS $$
-$val = 9**9**9;  # we assume this will overflow to +Inf
-return $val;
-$$;
-
-SELECT testInf();
-
-
-CREATE FUNCTION testNaN() RETURNS jsonb
-LANGUAGE plperlu
-TRANSFORM FOR TYPE jsonb
-AS $$
-$val = sin(9**9**9);  # we assume sin(inf) will yield NaN
-return $val;
-$$;
-
-SELECT testNaN();
-
-
 -- this revealed a bug in the original implementation
 CREATE FUNCTION testRegexpResultToJsonb() RETURNS jsonb
 LANGUAGE plperlu