Re: Error handling in plperl and pltcl

From: Thomas Hallgren <thhal(at)mailblocks(dot)com>
To: Jan Wieck <JanWieck(at)Yahoo(dot)com>
Cc: Brett Schwarz <brett_schwarz(at)Yahoo(dot)com>, Richard Huxton <dev(at)archonet(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, James William Pye <flaw(at)rhid(dot)com>, Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Error handling in plperl and pltcl
Date: 2004-12-03 21:02:52
Message-ID: thhal-0AG2MAhl5cC447L3gnhRw6KatZwB0Or@mailblocks.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Jan Wieck wrote:

> "as you now suggest"? I don't remember suggesting that. I concluded
> from your statements that _you_ are against changing Tcl's catch but
> instead want the savepoint functionality exposed to plain Tcl. So
> _you_ are against _my_ suggestion because these two are mutually
> exclusive.

I probably misinterpreted what you wrote in your last post where you
wrote "What you mean with "normal" savepoint handling in fact means that
we don't change catch at all but just expose the savepoint feature on
the Tcl level.". I thought you ment that you actually would expose the
savepoints in Tcl.

> You want the capabilities of C or Assembler (including all possible
> failures that lead to corruptions) in a trusted procedural language. I
> call that far from "ideal".

No I don't. I'm not sure how you came to that conclusion. I'm all for a
good, 100% safe design and clean interfaces.

> The point we where coming from was Tom's proposal to wrap each and
> every single SPI call into its own subtransaction for semantic
> reasons. My proposal was an improvement to that with respect to
> performance and IMHO also better matching the semantics.

As I said earlier, I think you proposal is great as a stop-gap solution
for 8.0. But when full savepoint support is enabled using SPI calls, the
implementation should change IMHO.

>
> Your suggestion to expose a plain savepoint interface to the
> programmer leads directly to the possiblity to commit a savepoint made
> by a sub-function in the caller and vice versa - which if I understood
> Tom correctly is what we need to avoid.

That particluar scenario is very easy to prevent. You just maintain a
savepoint structure that keeps track of function call level. The
lifecycle of a savepoint cannot exceed the lifecycle of the invocation
where it was created and it cannot be released or rolled back at a
higher level. An attemt to do so would yield an unrecoverable error.

Regards,
Thomas Hallgren

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrew Dunstan 2004-12-03 21:02:58 Re: OK, ready for RC1 or Beta6
Previous Message Tom Lane 2004-12-03 20:54:25 Re: Buildfarm coverage (was Re: OK, ready for RC1 or Beta6)