Re: Nested Transaction TODO list - Mailing list pgsql-hackers

From Honza Pazdziora
Subject Re: Nested Transaction TODO list
Date
Msg-id 20040707071622.GD11905@anxur.fi.muni.cz
Whole thread Raw
In response to Nested Transaction TODO list  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
On Sat, Jul 03, 2004 at 11:03:33AM -0400, Tom Lane wrote:
> than begin/commit for subxacts?  What about savepoints?)  Also, what about
> exposing this functionality in plpgsql?  Seems like we need some kind of
> exception handling syntax to make this useful.  What does Oracle do?

Oracle uses savepoints:
SAVEPOINT savepointname;

creates a savepoint or shifts existing savepoint of the same name;
ROLLBACK TO savepointname;

rolls back to savepoint (more verbose syntax also available);

The syntax of handling exceptions is (in PL/SQL):
BEGIN    some code, for example a bunch of SQL commands;EXCEPTION    WHEN nameofexception THEN        handle the
exception,maybe ROLLBACK;END;
 

There are predefined exceptions like INVALID_NUMBER, NO_DATA_FOUND,
ZERO_DIVIDE, or OTHERS.

-- 
------------------------------------------------------------------------Honza Pazdziora | adelton@fi.muni.cz |
http://www.fi.muni.cz/~adelton/.project:Perl, mod_perl, DBI, Oracle, large Web systems, XML/XSL, ...    Only
self-confidentpeople can be simple.
 


pgsql-hackers by date:

Previous
From: Christopher Kings-Lynne
Date:
Subject: Re: ALTER xxx SET TABLESPACE (was bug in DROP TABLESPACE)
Next
From: Oliver Jowett
Date:
Subject: Re: Nested Transactions, Abort All