Re: Error handling in plperl and pltcl

From: Jan Wieck <JanWieck(at)Yahoo(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Thomas Hallgren <thhal(at)mailblocks(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Error handling in plperl and pltcl
Date: 2004-11-29 20:54:26
Message-ID: 41AB8C82.8090208@Yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 11/19/2004 7:54 PM, Tom Lane wrote:
> Thomas Hallgren <thhal(at)mailblocks(dot)com> writes:
>> My approach with PL/Java is a bit different. While each SPI call is
>> using a try/catch they are not using a subtransaction. The catch will
>> however set a flag that will ensure two things:
>
>> 1. No more calls can be made from PL/Java to the postgres backend.
>> 2. Once PL/Java returns, the error will be re-thrown.
>
> That's what pltcl has always done, and IMHO it pretty well sucks :-(
> it's neither intuitive nor useful.

At the time that code was written it simply acted as a stopgap to
prevent subsequent SPI calls after elog while still unwinding the Tcl
call stack properly to avoid resource leaking inside of Tcl.

I don't agree that the right cure is to execute each and every statement
itself as a subtransaction. What we ought to do is to define a wrapper
for the catch Tcl command, that creates a subtransaction and executes
the code within during that.

Jan

--
#======================================================================#
# It's easier to get forgiveness for being wrong than for being right. #
# Let's break this rule - forgive me. #
#================================================== JanWieck(at)Yahoo(dot)com #

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Joe Conway 2004-11-29 20:59:09 Re: Opinions on Usenet ...
Previous Message Marc 2004-11-29 20:53:01 Re: Opinions on Usenet ...