summaryrefslogtreecommitdiff
path: root/contrib/jsonb_plpython
diff options
context:
space:
mode:
authorTom Lane2018-04-02 16:36:21 +0000
committerTom Lane2018-04-02 16:36:21 +0000
commit6278a2a262b63faaf47eb2371f6bcb5b6e3ff118 (patch)
treeaf770fe19e009af80cedb9103f2376060caea752 /contrib/jsonb_plpython
parentbeff4bb9c7411cfd973e192df05c0c1f5c796d22 (diff)
Remove contrib/jsonb_plpython's tests for infinity and NaN conversions.
These tests don't work reliably with pre-2.6 Python versions, since Python code like float('inf') was not guaranteed to work before that, even granting an IEEE-compliant platform. Since there's no explicit handling of these cases in jsonb_plpython, we're not adding any real code coverage by testing them, and thus it doesn't seem to make sense to go to any great lengths to work around the test instability. Discussion: https://postgr.es/m/[email protected]
Diffstat (limited to 'contrib/jsonb_plpython')
-rw-r--r--contrib/jsonb_plpython/expected/jsonb_plpython.out40
-rw-r--r--contrib/jsonb_plpython/sql/jsonb_plpython.sql35
2 files changed, 0 insertions, 75 deletions
diff --git a/contrib/jsonb_plpython/expected/jsonb_plpython.out b/contrib/jsonb_plpython/expected/jsonb_plpython.out
index 22a7e53b69f..b491fe9cc68 100644
--- a/contrib/jsonb_plpython/expected/jsonb_plpython.out
+++ b/contrib/jsonb_plpython/expected/jsonb_plpython.out
@@ -236,46 +236,6 @@ SELECT roundtrip('["string", "string2"]'::jsonb);
["string", "string2"]
(1 row)
--- test python infinity -> jsonb
-CREATE FUNCTION test1inf() RETURNS jsonb
-LANGUAGE plpythonu
-TRANSFORM FOR TYPE jsonb
-AS $$
-x = float('inf')
-print(x)
-return x
-$$;
-SELECT test1inf();
-ERROR: could not convert value "inf" to jsonb
-CONTEXT: while creating return value
-PL/Python function "test1inf"
--- test python -infinity -> jsonb
-CREATE FUNCTION test2inf() RETURNS jsonb
-LANGUAGE plpythonu
-TRANSFORM FOR TYPE jsonb
-AS $$
-x = float('-inf')
-print(x)
-return x
-$$;
-SELECT test2inf();
-ERROR: could not convert value "-inf" to jsonb
-CONTEXT: while creating return value
-PL/Python function "test2inf"
--- test python NaN -> jsonb
-CREATE FUNCTION test1nan() RETURNS jsonb
-LANGUAGE plpythonu
-TRANSFORM FOR TYPE jsonb
-AS $$
-x = float('nan')
-return x
-$$;
-SELECT test1nan();
- test1nan
-----------
- NaN
-(1 row)
-
-- complex numbers -> jsonb
CREATE FUNCTION testComplexNumbers() RETURNS jsonb
LANGUAGE plpythonu
diff --git a/contrib/jsonb_plpython/sql/jsonb_plpython.sql b/contrib/jsonb_plpython/sql/jsonb_plpython.sql
index b4b0820afe6..2ee1bca0a98 100644
--- a/contrib/jsonb_plpython/sql/jsonb_plpython.sql
+++ b/contrib/jsonb_plpython/sql/jsonb_plpython.sql
@@ -127,41 +127,6 @@ SELECT roundtrip('[1, true]'::jsonb);
SELECT roundtrip('[true, "string"]'::jsonb);
SELECT roundtrip('["string", "string2"]'::jsonb);
--- test python infinity -> jsonb
-CREATE FUNCTION test1inf() RETURNS jsonb
-LANGUAGE plpythonu
-TRANSFORM FOR TYPE jsonb
-AS $$
-x = float('inf')
-print(x)
-return x
-$$;
-
-SELECT test1inf();
-
--- test python -infinity -> jsonb
-CREATE FUNCTION test2inf() RETURNS jsonb
-LANGUAGE plpythonu
-TRANSFORM FOR TYPE jsonb
-AS $$
-x = float('-inf')
-print(x)
-return x
-$$;
-
-SELECT test2inf();
-
--- test python NaN -> jsonb
-CREATE FUNCTION test1nan() RETURNS jsonb
-LANGUAGE plpythonu
-TRANSFORM FOR TYPE jsonb
-AS $$
-x = float('nan')
-return x
-$$;
-
-SELECT test1nan();
-
-- complex numbers -> jsonb
CREATE FUNCTION testComplexNumbers() RETURNS jsonb
LANGUAGE plpythonu