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

Commit6278a2a

Browse files
committed
Remove contrib/jsonb_plpython's tests for infinity and NaN conversions.
These tests don't work reliably with pre-2.6 Python versions, sincePython 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 thusit doesn't seem to make sense to go to any great lengths to workaround the test instability.Discussion:https://postgr.es/m/E1f1AMU-00031c-9N@gemulon.postgresql.org
1 parentbeff4bb commit6278a2a

File tree

2 files changed

+0
-75
lines changed

2 files changed

+0
-75
lines changed

‎contrib/jsonb_plpython/expected/jsonb_plpython.out

Lines changed: 0 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -236,46 +236,6 @@ SELECT roundtrip('["string", "string2"]'::jsonb);
236236
["string", "string2"]
237237
(1 row)
238238

239-
-- test python infinity -> jsonb
240-
CREATE FUNCTION test1inf() RETURNS jsonb
241-
LANGUAGE plpythonu
242-
TRANSFORM FOR TYPE jsonb
243-
AS $$
244-
x = float('inf')
245-
print(x)
246-
return x
247-
$$;
248-
SELECT test1inf();
249-
ERROR: could not convert value "inf" to jsonb
250-
CONTEXT: while creating return value
251-
PL/Python function "test1inf"
252-
-- test python -infinity -> jsonb
253-
CREATE FUNCTION test2inf() RETURNS jsonb
254-
LANGUAGE plpythonu
255-
TRANSFORM FOR TYPE jsonb
256-
AS $$
257-
x = float('-inf')
258-
print(x)
259-
return x
260-
$$;
261-
SELECT test2inf();
262-
ERROR: could not convert value "-inf" to jsonb
263-
CONTEXT: while creating return value
264-
PL/Python function "test2inf"
265-
-- test python NaN -> jsonb
266-
CREATE FUNCTION test1nan() RETURNS jsonb
267-
LANGUAGE plpythonu
268-
TRANSFORM FOR TYPE jsonb
269-
AS $$
270-
x = float('nan')
271-
return x
272-
$$;
273-
SELECT test1nan();
274-
test1nan
275-
----------
276-
NaN
277-
(1 row)
278-
279239
-- complex numbers -> jsonb
280240
CREATE FUNCTION testComplexNumbers() RETURNS jsonb
281241
LANGUAGE plpythonu

‎contrib/jsonb_plpython/sql/jsonb_plpython.sql

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -127,41 +127,6 @@ SELECT roundtrip('[1, true]'::jsonb);
127127
SELECT roundtrip('[true, "string"]'::jsonb);
128128
SELECT roundtrip('["string", "string2"]'::jsonb);
129129

130-
-- test python infinity -> jsonb
131-
CREATEFUNCTIONtest1inf() RETURNS jsonb
132-
LANGUAGE plpythonu
133-
TRANSFORM FOR TYPE jsonb
134-
AS $$
135-
x= float('inf')
136-
print(x)
137-
return x
138-
$$;
139-
140-
SELECT test1inf();
141-
142-
-- test python -infinity -> jsonb
143-
CREATEFUNCTIONtest2inf() RETURNS jsonb
144-
LANGUAGE plpythonu
145-
TRANSFORM FOR TYPE jsonb
146-
AS $$
147-
x= float('-inf')
148-
print(x)
149-
return x
150-
$$;
151-
152-
SELECT test2inf();
153-
154-
-- test python NaN -> jsonb
155-
CREATEFUNCTIONtest1nan() RETURNS jsonb
156-
LANGUAGE plpythonu
157-
TRANSFORM FOR TYPE jsonb
158-
AS $$
159-
x= float('nan')
160-
return x
161-
$$;
162-
163-
SELECT test1nan();
164-
165130
-- complex numbers -> jsonb
166131
CREATEFUNCTIONtestComplexNumbers() RETURNS jsonb
167132
LANGUAGE plpythonu

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp