Thread: How to track error messages come from plpy.execute?

How to track error messages come from plpy.execute?

From
guti deng
Date:
Hi there,

The problem is, i call a stored function with 'plpy.execute()', and there may be error thrown out from the callee function. I want to get the error message.
I try to put plpy.execute into  a python try-except, but i doesn't work.
Anyone has an idea?


Explanation about the context:

create function func_throw_error() returns integer as
$BODY$
declare
begin
    select some obvioursly wrong SQL;
end;
$BODY$
language 'plpgsql';

create function func_caller returns integer as
$BODY$
try:
    plpy.execute('select func_throw_error()')
except Exception, e:
    print e
return 0
$BODY$
language 'plpythonu';