On Tue, 2006-02-28 at 15:26 -0500, Tom Lane wrote:
> Yeah, "unexpected" doesn't seem the mot juste here. [...]
All good points -- thanks for the suggestions. I've applied the attached
patch to HEAD.
-Neil
============================================================
*** src/pl/plpython/expected/plpython_test.out 0f691c1fda20c66e8795d2f953fb79fc92fdd02c
--- src/pl/plpython/expected/plpython_test.out 40eb5c736cf022165076b07299e5fad0fd8f841b
***************
*** 190,197 ****
(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
------------------+---------
--- 190,197 ----
(1 row)
SELECT test_void_func2(); -- should fail
! ERROR: invalid return value from plpython function
! DETAIL: Functions returning type "void" must return "None".
SELECT test_return_none(), test_return_none() IS NULL AS "is null";
test_return_none | is null
------------------+---------
============================================================
*** src/pl/plpython/plpython.c bb0fdc6a4bfc35b18b98e3c92f421c41c2898052
--- src/pl/plpython/plpython.c 4cce33c125fbf2a9102cc34e94d0cc1d3d47ea01
***************
*** 769,776 ****
if (plrv != Py_None)
ereport(ERROR,
(errcode(ERRCODE_DATATYPE_MISMATCH),
! errmsg("unexpected return value from plpython procedure"),
! errdetail("void-returning functions must return \"None\"")));
fcinfo->isnull = false;
rv = (Datum) 0;
--- 769,776 ----
if (plrv != Py_None)
ereport(ERROR,
(errcode(ERRCODE_DATATYPE_MISMATCH),
! errmsg("invalid return value from plpython function"),
! errdetail("Functions returning type \"void\" must return \"None\".")));
fcinfo->isnull = false;
rv = (Datum) 0;
---------------------------(end of broadcast)---------------------------
TIP 6: explain analyze is your friend