Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit827eb43

Browse files
committed
Tweak new jsonb_plperl test cases to work with old Perl versions.
The previous coding here didn't actually produce Inf or NaN doublevalues in Perl versions 5.8.x. Adopt a suggestion from stackoverflow.Discussion:https://postgr.es/m/28585.1525131438@sss.pgh.pa.us
1 parent2307868 commit827eb43

File tree

4 files changed

+8
-8
lines changed

4 files changed

+8
-8
lines changed

‎contrib/jsonb_plperl/expected/jsonb_plperl.out

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ CREATE FUNCTION testInf() RETURNS jsonb
4343
LANGUAGE plperl
4444
TRANSFORM FOR TYPE jsonb
4545
AS $$
46-
$val =0 + 'Inf';
46+
$val =9**9**9; # we assume this will overflow to +Inf
4747
return $val;
4848
$$;
4949
SELECT testInf();
@@ -53,7 +53,7 @@ CREATE FUNCTION testNaN() RETURNS jsonb
5353
LANGUAGE plperl
5454
TRANSFORM FOR TYPE jsonb
5555
AS $$
56-
$val =0 + 'NaN';
56+
$val =sin(9**9**9); # we assume sin(inf) will yieldNaN
5757
return $val;
5858
$$;
5959
SELECT testNaN();

‎contrib/jsonb_plperl/expected/jsonb_plperlu.out

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ CREATE FUNCTION testInf() RETURNS jsonb
4343
LANGUAGE plperlu
4444
TRANSFORM FOR TYPE jsonb
4545
AS $$
46-
$val =0 + 'Inf';
46+
$val =9**9**9; # we assume this will overflow to +Inf
4747
return $val;
4848
$$;
4949
SELECT testInf();
@@ -53,7 +53,7 @@ CREATE FUNCTION testNaN() RETURNS jsonb
5353
LANGUAGE plperlu
5454
TRANSFORM FOR TYPE jsonb
5555
AS $$
56-
$val =0 + 'NaN';
56+
$val =sin(9**9**9); # we assume sin(inf) will yieldNaN
5757
return $val;
5858
$$;
5959
SELECT testNaN();

‎contrib/jsonb_plperl/sql/jsonb_plperl.sql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ CREATE FUNCTION testInf() RETURNS jsonb
3838
LANGUAGE plperl
3939
TRANSFORM FOR TYPE jsonb
4040
AS $$
41-
$val=0+'Inf';
41+
$val=9**9**9;# we assume this will overflow to +Inf
4242
return $val;
4343
$$;
4444

@@ -49,7 +49,7 @@ CREATE FUNCTION testNaN() RETURNS jsonb
4949
LANGUAGE plperl
5050
TRANSFORM FOR TYPE jsonb
5151
AS $$
52-
$val=0+'NaN';
52+
$val=sin(9**9**9);# we assume sin(inf) will yieldNaN
5353
return $val;
5454
$$;
5555

‎contrib/jsonb_plperl/sql/jsonb_plperlu.sql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ CREATE FUNCTION testInf() RETURNS jsonb
3838
LANGUAGE plperlu
3939
TRANSFORM FOR TYPE jsonb
4040
AS $$
41-
$val=0+'Inf';
41+
$val=9**9**9;# we assume this will overflow to +Inf
4242
return $val;
4343
$$;
4444

@@ -49,7 +49,7 @@ CREATE FUNCTION testNaN() RETURNS jsonb
4949
LANGUAGE plperlu
5050
TRANSFORM FOR TYPE jsonb
5151
AS $$
52-
$val=0+'NaN';
52+
$val=sin(9**9**9);# we assume sin(inf) will yieldNaN
5353
return $val;
5454
$$;
5555

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp