On 11/19/2004 7:54 PM, Tom Lane wrote:
> Thomas Hallgren <thhal@mailblocks.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@Yahoo.com #