Augment test coverage in PL/Python, especially for error conditions.

This commit is contained in:
Peter Eisentraut
2009-08-13 20:50:05 +00:00
parent 501255114d
commit cfe380a6dd
14 changed files with 573 additions and 34 deletions

View File

@ -1,6 +1,13 @@
--
-- Test returning SETOF
--
CREATE FUNCTION test_setof_error() RETURNS SETOF text AS $$
return 37
$$ LANGUAGE plpythonu;
SELECT test_setof_error();
ERROR: returned object cannot be iterated
DETAIL: PL/Python set-returning functions must return an iterable object.
CONTEXT: PL/Python function "test_setof_error"
CREATE FUNCTION test_setof_as_list(count integer, content text) RETURNS SETOF text AS $$
return [ content ]*count
$$ LANGUAGE plpythonu;