How to track error messages come from plpy.execute? - Mailing list pgsql-general

From guti deng
Subject How to track error messages come from plpy.execute?
Date
Msg-id AANLkTimzu_LYu3FNt+J-Yad2BWqLmAkxB9JGtSByFkn1@mail.gmail.com
Whole thread Raw
List pgsql-general
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';

pgsql-general by date:

Previous
From: "Brent Wood"
Date:
Subject: Re: Selecting top N percent of records.
Next
From: Craig Ringer
Date:
Subject: Re: installing from source in Windows