From: | Thomas Hallgren <thhal(at)mailblocks(dot)com> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | pgsql-hackers(at)postgreSQL(dot)org |
Subject: | Re: Error handling in plperl and pltcl |
Date: | 2004-11-20 07:53:08 |
Message-ID: | thhal-0Z5B6AkvYby4lw4gLjPyDuGdUdj0mr6@mailblocks.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
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.
>
>
Given that most SPI actions that you do doesn't elog (most of them are
typically read-only), it's far more useful than imposing the overhead of
a subtransaction on all calls. That IMHO, would really suck :-(
Ideally, the behavior should be managed so that if a subtransaction is
started intentionally, crash recovery would be possible and the function
should be able to continue after it has issued a rollback of that
subtransaction.
I'm suprised you say that this is not useful. I've found that in most
cases when you encounter an elog, this is the most intuitive behavior.
Either you don't do any cleanup, i.e. just return and let the elog be
re-thrown, or you close some files, free up some resources or whatever,
then you return. Not many functions would continue executing after an
elog, unless of course, you *intentionally* started a subtransaction.
I'll investigate what's entailed in handling SPI calls performed in a
subtransaction differently so that calls are blocked only until the
subtransaction is rolled back. Since I have my own JDBC driver, that
doesn't sound too hard. I guess PL/Perl and PL/Tcl has something similar
where they could track this.
Such handling, in combination with a "recoverable" status in the elog's
error structure, would create a really nice (end efficient) subsystem.
Regards,
Thomas Hallgren
From | Date | Subject | |
---|---|---|---|
Next Message | Simon Riggs | 2004-11-20 08:38:59 | Re: [Testperf-general] Re: ExclusiveLock |
Previous Message | Barry Lind | 2004-11-20 01:40:04 | Re: [JDBC] Strange server error with current 8.0beta driver |