Commit 827eb439 authored by Tom Lane's avatar Tom Lane

Tweak new jsonb_plperl test cases to work with old Perl versions.

The previous coding here didn't actually produce Inf or NaN double
values in Perl versions 5.8.x.  Adopt a suggestion from stackoverflow.

Discussion: https://postgr.es/m/28585.1525131438@sss.pgh.pa.us
parent 23078689
......@@ -43,7 +43,7 @@ CREATE FUNCTION testInf() RETURNS jsonb
LANGUAGE plperl
TRANSFORM FOR TYPE jsonb
AS $$
$val = 0 + 'Inf';
$val = 9**9**9; # we assume this will overflow to +Inf
return $val;
$$;
SELECT testInf();
......@@ -53,7 +53,7 @@ CREATE FUNCTION testNaN() RETURNS jsonb
LANGUAGE plperl
TRANSFORM FOR TYPE jsonb
AS $$
$val = 0 + 'NaN';
$val = sin(9**9**9); # we assume sin(inf) will yield NaN
return $val;
$$;
SELECT testNaN();
......
......@@ -43,7 +43,7 @@ CREATE FUNCTION testInf() RETURNS jsonb
LANGUAGE plperlu
TRANSFORM FOR TYPE jsonb
AS $$
$val = 0 + 'Inf';
$val = 9**9**9; # we assume this will overflow to +Inf
return $val;
$$;
SELECT testInf();
......@@ -53,7 +53,7 @@ CREATE FUNCTION testNaN() RETURNS jsonb
LANGUAGE plperlu
TRANSFORM FOR TYPE jsonb
AS $$
$val = 0 + 'NaN';
$val = sin(9**9**9); # we assume sin(inf) will yield NaN
return $val;
$$;
SELECT testNaN();
......
......@@ -38,7 +38,7 @@ CREATE FUNCTION testInf() RETURNS jsonb
LANGUAGE plperl
TRANSFORM FOR TYPE jsonb
AS $$
$val = 0 + 'Inf';
$val = 9**9**9; # we assume this will overflow to +Inf
return $val;
$$;
......@@ -49,7 +49,7 @@ CREATE FUNCTION testNaN() RETURNS jsonb
LANGUAGE plperl
TRANSFORM FOR TYPE jsonb
AS $$
$val = 0 + 'NaN';
$val = sin(9**9**9); # we assume sin(inf) will yield NaN
return $val;
$$;
......
......@@ -38,7 +38,7 @@ CREATE FUNCTION testInf() RETURNS jsonb
LANGUAGE plperlu
TRANSFORM FOR TYPE jsonb
AS $$
$val = 0 + 'Inf';
$val = 9**9**9; # we assume this will overflow to +Inf
return $val;
$$;
......@@ -49,7 +49,7 @@ CREATE FUNCTION testNaN() RETURNS jsonb
LANGUAGE plperlu
TRANSFORM FOR TYPE jsonb
AS $$
$val = 0 + 'NaN';
$val = sin(9**9**9); # we assume sin(inf) will yield NaN
return $val;
$$;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment