How to track error messages come from plpy.execute?

From: guti deng <guti(dot)deng(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: How to track error messages come from plpy.execute?
Date: 2010-10-18 03:44:32
Message-ID: AANLkTimzu_LYu3FNt+J-Yad2BWqLmAkxB9JGtSByFkn1@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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';

Browse pgsql-general by date

  From Date Subject
Next Message Craig Ringer 2010-10-18 03:45:46 Re: installing from source in Windows
Previous Message Turner, John J 2010-10-18 03:28:33 Re: installing from source in Windows