Remove jsonb_plperl test cases for Inf/NaN conversions.

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
This commit is contained in:
Tom Lane 2018-05-01 13:21:16 -04:00
parent bcbf2346d6
commit 6594ee2803
4 changed files with 2 additions and 86 deletions

View File

@ -39,26 +39,6 @@ SELECT testSVToJsonb();
1 1
(1 row) (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 -- this revealed a bug in the original implementation
CREATE FUNCTION testRegexpResultToJsonb() RETURNS jsonb CREATE FUNCTION testRegexpResultToJsonb() RETURNS jsonb
LANGUAGE plperl LANGUAGE plperl
@ -227,4 +207,4 @@ SELECT roundtrip('{"1": {"2": [3, 4, 5]}, "2": 3}');
\set VERBOSITY terse \\ -- suppress cascade details \set VERBOSITY terse \\ -- suppress cascade details
DROP EXTENSION plperl CASCADE; DROP EXTENSION plperl CASCADE;
NOTICE: drop cascades to 8 other objects NOTICE: drop cascades to 6 other objects

View File

@ -39,26 +39,6 @@ SELECT testSVToJsonb();
1 1
(1 row) (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 -- this revealed a bug in the original implementation
CREATE FUNCTION testRegexpResultToJsonb() RETURNS jsonb CREATE FUNCTION testRegexpResultToJsonb() RETURNS jsonb
LANGUAGE plperlu LANGUAGE plperlu
@ -227,4 +207,4 @@ SELECT roundtrip('{"1": {"2": [3, 4, 5]}, "2": 3}');
\set VERBOSITY terse \\ -- suppress cascade details \set VERBOSITY terse \\ -- suppress cascade details
DROP EXTENSION plperlu CASCADE; DROP EXTENSION plperlu CASCADE;
NOTICE: drop cascades to 8 other objects NOTICE: drop cascades to 6 other objects

View File

@ -34,28 +34,6 @@ $$;
SELECT testSVToJsonb(); 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 -- this revealed a bug in the original implementation
CREATE FUNCTION testRegexpResultToJsonb() RETURNS jsonb CREATE FUNCTION testRegexpResultToJsonb() RETURNS jsonb
LANGUAGE plperl LANGUAGE plperl

View File

@ -34,28 +34,6 @@ $$;
SELECT testSVToJsonb(); 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 -- this revealed a bug in the original implementation
CREATE FUNCTION testRegexpResultToJsonb() RETURNS jsonb CREATE FUNCTION testRegexpResultToJsonb() RETURNS jsonb
LANGUAGE plperlu LANGUAGE plperlu