Re: What are nested transactions then? was Nested

From: "John Sidney-Woollett" <johnsw(at)wardbrook(dot)com>
To: "Martijn van Oosterhout" <kleptog(at)svana(dot)org>
Cc: "Chris Travers" <chris(at)travelamericas(dot)com>, johnsw(at)wardbrook(dot)com, "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-general(at)postgresql(dot)org
Subject: Re: What are nested transactions then? was Nested
Date: 2004-01-14 12:02:51
Message-ID: 1454.192.168.0.64.1074081771.squirrel@mercury.wardbrook.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Martijn van Oosterhout said:
> In any case, I don't quite understand the intended semantics of "duplicate
> key shouldn't rollback transaction". If I call a function that inserts a
> duplicate key, should the other effects of the function be rolled back or
> not? Anyone know how MSSQL deals with this?

In Oracle (I believe) that the exception is propogated up to abort the
initiating transaction unless you explictly place the SQL call which
failed in a begin..exception..end block (like below)

begin
-- do some SQL stuff here
exception
when NO_DATA_FOUND then
-- handle the exception
end;

You also have the option to RAISE an exception to abort the transaction
after you handled the error and decided that there is nothing useful you
can do.

Maybe, (don't shoot me) better procedural (pl/pgsql) error/exception
handling ought to be a dealt with before nested transaction support?

John Sidney-Woollett

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Bob Parkinson 2004-01-14 12:13:44 Re: Drawbacks of using BYTEA for PK?
Previous Message terry 2004-01-14 11:51:00 Re: Using regular expressions in LIKE