Use errcontext mechanism in PL/Python

Error messages from PL/Python now always mention the function name in the
CONTEXT: field.  This also obsoletes the few places that tried to do the
same manually.

Regression test files are updated to work with Python 2.4-2.6.  I don't have
access to older versions right now.
This commit is contained in:
Peter Eisentraut
2009-07-20 08:01:07 +00:00
parent 888d3335b1
commit 5106bdc450
5 changed files with 127 additions and 61 deletions

View File

@ -38,6 +38,7 @@ SELECT global_test_two();
--
SELECT import_fail();
NOTICE: ('import socket failed -- No module named foosocket',)
CONTEXT: PL/Python function "import_fail"
import_fail
--------------------
failed as expected
@ -191,6 +192,7 @@ SELECT test_void_func1(), test_void_func1() IS NULL AS "is null";
SELECT test_void_func2(); -- should fail
ERROR: PL/Python function with return type "void" did not return None
CONTEXT: PL/Python function "test_void_func2"
SELECT test_return_none(), test_return_none() IS NULL AS "is null";
test_return_none | is null
------------------+---------