Skip to content

Commit 6594ee2

Browse files
committed
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/[email protected]
1 parent bcbf234 commit 6594ee2

File tree

4 files changed

+2
-86
lines changed

4 files changed

+2
-86
lines changed

contrib/jsonb_plperl/expected/jsonb_plperl.out

+1-21
Original file line numberDiff line numberDiff line change
@@ -39,26 +39,6 @@ SELECT testSVToJsonb();
3939
1
4040
(1 row)
4141

42-
CREATE FUNCTION testInf() RETURNS jsonb
43-
LANGUAGE plperl
44-
TRANSFORM FOR TYPE jsonb
45-
AS $$
46-
$val = 9**9**9; # we assume this will overflow to +Inf
47-
return $val;
48-
$$;
49-
SELECT testInf();
50-
ERROR: cannot convert infinity to jsonb
51-
CONTEXT: PL/Perl function "testinf"
52-
CREATE FUNCTION testNaN() RETURNS jsonb
53-
LANGUAGE plperl
54-
TRANSFORM FOR TYPE jsonb
55-
AS $$
56-
$val = sin(9**9**9); # we assume sin(inf) will yield NaN
57-
return $val;
58-
$$;
59-
SELECT testNaN();
60-
ERROR: cannot convert NaN to jsonb
61-
CONTEXT: PL/Perl function "testnan"
6242
-- this revealed a bug in the original implementation
6343
CREATE FUNCTION testRegexpResultToJsonb() RETURNS jsonb
6444
LANGUAGE plperl
@@ -227,4 +207,4 @@ SELECT roundtrip('{"1": {"2": [3, 4, 5]}, "2": 3}');
227207

228208
\set VERBOSITY terse \\ -- suppress cascade details
229209
DROP EXTENSION plperl CASCADE;
230-
NOTICE: drop cascades to 8 other objects
210+
NOTICE: drop cascades to 6 other objects

contrib/jsonb_plperl/expected/jsonb_plperlu.out

+1-21
Original file line numberDiff line numberDiff line change
@@ -39,26 +39,6 @@ SELECT testSVToJsonb();
3939
1
4040
(1 row)
4141

42-
CREATE FUNCTION testInf() RETURNS jsonb
43-
LANGUAGE plperlu
44-
TRANSFORM FOR TYPE jsonb
45-
AS $$
46-
$val = 9**9**9; # we assume this will overflow to +Inf
47-
return $val;
48-
$$;
49-
SELECT testInf();
50-
ERROR: cannot convert infinity to jsonb
51-
CONTEXT: PL/Perl function "testinf"
52-
CREATE FUNCTION testNaN() RETURNS jsonb
53-
LANGUAGE plperlu
54-
TRANSFORM FOR TYPE jsonb
55-
AS $$
56-
$val = sin(9**9**9); # we assume sin(inf) will yield NaN
57-
return $val;
58-
$$;
59-
SELECT testNaN();
60-
ERROR: cannot convert NaN to jsonb
61-
CONTEXT: PL/Perl function "testnan"
6242
-- this revealed a bug in the original implementation
6343
CREATE FUNCTION testRegexpResultToJsonb() RETURNS jsonb
6444
LANGUAGE plperlu
@@ -227,4 +207,4 @@ SELECT roundtrip('{"1": {"2": [3, 4, 5]}, "2": 3}');
227207

228208
\set VERBOSITY terse \\ -- suppress cascade details
229209
DROP EXTENSION plperlu CASCADE;
230-
NOTICE: drop cascades to 8 other objects
210+
NOTICE: drop cascades to 6 other objects

contrib/jsonb_plperl/sql/jsonb_plperl.sql

-22
Original file line numberDiff line numberDiff line change
@@ -34,28 +34,6 @@ $$;
3434
SELECT testSVToJsonb();
3535

3636

37-
CREATE FUNCTION testInf() RETURNS jsonb
38-
LANGUAGE plperl
39-
TRANSFORM FOR TYPE jsonb
40-
AS $$
41-
$val = 9**9**9; # we assume this will overflow to +Inf
42-
return $val;
43-
$$;
44-
45-
SELECT testInf();
46-
47-
48-
CREATE FUNCTION testNaN() RETURNS jsonb
49-
LANGUAGE plperl
50-
TRANSFORM FOR TYPE jsonb
51-
AS $$
52-
$val = sin(9**9**9); # we assume sin(inf) will yield NaN
53-
return $val;
54-
$$;
55-
56-
SELECT testNaN();
57-
58-
5937
-- this revealed a bug in the original implementation
6038
CREATE FUNCTION testRegexpResultToJsonb() RETURNS jsonb
6139
LANGUAGE plperl

contrib/jsonb_plperl/sql/jsonb_plperlu.sql

-22
Original file line numberDiff line numberDiff line change
@@ -34,28 +34,6 @@ $$;
3434
SELECT testSVToJsonb();
3535

3636

37-
CREATE FUNCTION testInf() RETURNS jsonb
38-
LANGUAGE plperlu
39-
TRANSFORM FOR TYPE jsonb
40-
AS $$
41-
$val = 9**9**9; # we assume this will overflow to +Inf
42-
return $val;
43-
$$;
44-
45-
SELECT testInf();
46-
47-
48-
CREATE FUNCTION testNaN() RETURNS jsonb
49-
LANGUAGE plperlu
50-
TRANSFORM FOR TYPE jsonb
51-
AS $$
52-
$val = sin(9**9**9); # we assume sin(inf) will yield NaN
53-
return $val;
54-
$$;
55-
56-
SELECT testNaN();
57-
58-
5937
-- this revealed a bug in the original implementation
6038
CREATE FUNCTION testRegexpResultToJsonb() RETURNS jsonb
6139
LANGUAGE plperlu

0 commit comments

Comments
 (0)