1
0
mirror of https://github.com/postgres/postgres.git synced 2025-06-11 20:28:21 +03:00

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/E1f1AMU-00031c-9N@gemulon.postgresql.org
This commit is contained in:
Tom Lane
2018-04-02 12:36:21 -04:00
parent beff4bb9c7
commit 6278a2a262
2 changed files with 0 additions and 75 deletions

View File

@ -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