From 87daae1143520309da299b78a8e7a68f141a268f Mon Sep 17 00:00:00 2001 From: Neil Conway Date: Tue, 28 Feb 2006 20:03:52 +0000 Subject: Allow PL/Python functions to return void, per gripe from James Robinson (I didn't use his patch, however). A void-returning PL/Python function must return None (from Python), which is translated into a void datum (and *not* NULL) for Postgres. I also added some regression tests for this functionality. --- src/pl/plpython/expected/plpython_test.out | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'src/pl/plpython/expected/plpython_test.out') diff --git a/src/pl/plpython/expected/plpython_test.out b/src/pl/plpython/expected/plpython_test.out index 08704cb571..92243738f6 100644 --- a/src/pl/plpython/expected/plpython_test.out +++ b/src/pl/plpython/expected/plpython_test.out @@ -182,3 +182,19 @@ SELECT newline_crlf(); 123 (1 row) +-- Tests for functions returning void +SELECT test_void_func1(), test_void_func1() IS NULL AS "is null"; + test_void_func1 | is null +-----------------+--------- + | f +(1 row) + +SELECT test_void_func2(); -- should fail +ERROR: unexpected return value from plpython procedure +DETAIL: void-returning functions must return "None" +SELECT test_return_none(), test_return_none() IS NULL AS "is null"; + test_return_none | is null +------------------+--------- + | t +(1 row) + -- cgit v1.2.1