1--
2-- Tests for functions that return void
3--
4CREATE FUNCTION test_void_func1() RETURNS void AS $$
5x = 10
6$$ LANGUAGE plpythonu;
7-- illegal: can't return non-None value in void-returning func
8CREATE FUNCTION test_void_func2() RETURNS void AS $$
9return 10
10$$ LANGUAGE plpythonu;
11CREATE FUNCTION test_return_none() RETURNS int AS $$
12None
13$$ LANGUAGE plpythonu;
14-- Tests for functions returning void
15SELECT test_void_func1(), test_void_func1() IS NULL AS "is null";
16 test_void_func1 | is null
17-----------------+---------
18                 | f
19(1 row)
20
21SELECT test_void_func2(); -- should fail
22ERROR:  PL/Python function with return type "void" did not return None
23CONTEXT:  while creating return value
24PL/Python function "test_void_func2"
25SELECT test_return_none(), test_return_none() IS NULL AS "is null";
26 test_return_none | is null
27------------------+---------
28                  | t
29(1 row)
30
31