Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 2b8afe6

Browse files
author
Neil Conway
committed
Tweak the error message emitted when a void-returning PL/Python function
does not return None, per suggestion from Tom.
1 parent 87daae1 commit 2b8afe6

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/pl/plpython/expected/plpython_test.out

+2-2
Original file line numberDiff line numberDiff line change
@@ -190,8 +190,8 @@ SELECT test_void_func1(), test_void_func1() IS NULL AS "is null";
190190
(1 row)
191191

192192
SELECT test_void_func2(); -- should fail
193-
ERROR: unexpected return value from plpython procedure
194-
DETAIL: void-returning functions must return "None"
193+
ERROR: invalid return value from plpython function
194+
DETAIL: Functions returning type "void" must return "None".
195195
SELECT test_return_none(), test_return_none() IS NULL AS "is null";
196196
test_return_none | is null
197197
------------------+---------

src/pl/plpython/plpython.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
* MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
3030
*
3131
* IDENTIFICATION
32-
* $PostgreSQL: pgsql/src/pl/plpython/plpython.c,v 1.72 2006/02/28 20:03:52 neilc Exp $
32+
* $PostgreSQL: pgsql/src/pl/plpython/plpython.c,v 1.73 2006/02/28 20:56:14 neilc Exp $
3333
*
3434
*********************************************************************
3535
*/
@@ -769,8 +769,8 @@ PLy_function_handler(FunctionCallInfo fcinfo, PLyProcedure * proc)
769769
if (plrv != Py_None)
770770
ereport(ERROR,
771771
(errcode(ERRCODE_DATATYPE_MISMATCH),
772-
errmsg("unexpected return value from plpython procedure"),
773-
errdetail("void-returning functions must return \"None\"")));
772+
errmsg("invalid return value from plpython function"),
773+
errdetail("Functions returning type \"void\" must return \"None\".")));
774774

775775
fcinfo->isnull = false;
776776
rv = (Datum) 0;

0 commit comments

Comments
 (0)