pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Sergey Konoplev <gray.ru@gmail.com>
Cc: Dragos Valentin Moinescu <dragos.moinescu@gmail.com>
Cc: pgsql-admin@postgresql.org
Subject: Re: plpythonu: how to catch plpy.execute() exceptions
Date: Fri, 29 Oct 2010 10:40:12 -0400
Message-ID: <1362.1288363212@sss.pgh.pa.us> (raw)
In-Reply-To: <AANLkTik7H6hp1=WL1agKbv315b95A_PFSCxLbVETDJOc@mail.gmail.com>
References: <AANLkTi=aaz=kv_08QH1tGPhK4b_Q1TwRk1tMbQX3fWVk@mail.gmail.com>
	<AANLkTik7H6hp1=WL1agKbv315b95A_PFSCxLbVETDJOc@mail.gmail.com>

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



view thread (6+ messages)  latest in thread

Message-ID: <1362.1288363212@sss.pgh.pa.us>
Permalink:  ../1362.1288363212@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/1362.1288363212@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-admin@postgresql.org
  Cc: tgl@sss.pgh.pa.us, gray.ru@gmail.com, dragos.moinescu@gmail.com
  Subject: Re: plpythonu: how to catch plpy.execute() exceptions
  In-Reply-To: <1362.1288363212@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox