Re: plpythonu: how to catch plpy.execute() exceptions - Mailing list pgsql-admin

From Tom Lane
Subject Re: plpythonu: how to catch plpy.execute() exceptions
Date
Msg-id 1362.1288363212@sss.pgh.pa.us
Whole thread Raw
In response to Re: plpythonu: how to catch plpy.execute() exceptions  (Sergey Konoplev <gray.ru@gmail.com>)
Responses Re: plpythonu: how to catch plpy.execute() exceptions
List pgsql-admin
Sergey Konoplev <gray.ru@gmail.com> writes:
> On 29 October 2010 17:02, Dragos Valentin Moinescu
> <dragos.moinescu@gmail.com> wrote:
>> The thing is that I cannot catch the exception raised by plpy.execute().

> I came to this plpython function template. It handles errors properly
> and works faster then usual function because of the code caching.

Really?  As far as I can see, it's entirely impossible for a plpython
function to trap and recover from an error in plpy.execute.  It can
continue to run plain python code, but it won't be allowed to call
plpy.execute again, and the error will be rethrown when control exits
the function.  There's no way to fix that short of setting up
subtransactions, which is what the other PLs do.

            regards, tom lane

pgsql-admin by date:

Previous
From: Tom Lane
Date:
Subject: Re: plpythonu: how to catch plpy.execute() exceptions
Next
From: Sergey Konoplev
Date:
Subject: Re: plpythonu: how to catch plpy.execute() exceptions