Re: Sketch of extending error handling for subtransactions - Mailing list pgsql-hackers

From Gaetano Mendola
Subject Re: Sketch of extending error handling for subtransactions
Date
Msg-id 41042B30.4030305@bigfoot.com
Whole thread Raw
In response to Re: Sketch of extending error handling for subtransactions  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Sketch of extending error handling for subtransactions
List pgsql-hackers
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Tom Lane wrote:

| Bruce Momjian <pgman@candle.pha.pa.us> writes:
|
|>So it allows functions to use subtransactions and recover from errors.
|>I thought that was more than we could do for 7.5 and in fact the release
|>notes now saw that will be done in a future release.
|
|
| I think there's only a day or two's work between here and there, and it
| would be foolish not to have the feature if we can get it.
|
| As I see it, we need:
|
| 1. The elog.c factoring described in this thread.
|
| 2. An extension to the SPI API to allow execution of commands within
|    a subtransaction, with catching of errors.
|
| 3. A bit of work on plpgsql to support some kind of EXCEPTION syntax.
|
| I might decide to forget about SPI and trap errors directly in plpgsql,
| but in any case it doesn't seem out of reach.
|
| I was just looking around the net to see exactly what Oracle's PL/SQL
| syntax is.  It doesn't seem too unreasonable syntax-wise:
|
|     BEGIN
|         ... controlled statements ...
|     EXCEPTION
|         WHEN exception_name THEN
|             ... error handling statements ...
|         WHEN exception_name THEN
|             ... error handling statements ...
|         ...
|         WHEN OTHERS THEN
|             ... error handling statements ...
|     END;

Is this sintax SQL standard driven ?
If not I'd prefere this one:


~        TRY
~            ... controlled statements ...

~        CATCH INTEGER THEN
~            ... error handling statements ...
~        CATCH VARCHAR THEN
~                ... error handling statements ...
~         ...
~        CATCH OTHERS THEN    ... error handling statements ...
~        END;    


and of course who trhow the exception:

~            THROW 3::INTEGER;

in this way who throw the exception can also transfer informations
on what is going on.


Am I may be not understanding what are you trying to do ?


Regards
Gaetano Mendola













-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (MingW32)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFBBCsu7UpzwH2SGd4RAo1aAKDUX+afgx+RjBdCtG9sdGp9eT6j1QCfasdq
hcm4Vt2RLsoN5cSvIfbgGiw=
=iJgV
-----END PGP SIGNATURE-----



pgsql-hackers by date:

Previous
From: Gaetano Mendola
Date:
Subject: Re: storage engine , mysql syntax CREATE TABLE t (i INT)
Next
From: Bruce Momjian
Date:
Subject: Re: Planning for beta (was Re: Sketch of extending error handling