Re: Rollback for aborted function?

From: "scott(dot)marlowe" <scott(dot)marlowe(at)ihs(dot)com>
To: Rory Campbell-Lange <rory(at)campbell-lange(dot)net>
Cc: Postgres General <pgsql-general(at)postgresql(dot)org>
Subject: Re: Rollback for aborted function?
Date: 2003-07-03 20:03:35
Message-ID: Pine.LNX.4.33.0307031400370.22660-100000@css120.ihs.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Thu, 3 Jul 2003, Rory Campbell-Lange wrote:

> If a function generates an exception, do I need to rollback manually?

Not currently. The current bevaviour of postgresql is to roll back any
transaction that generates an error. Of course, it's considered good
practice to do it in some circles. And someday there will be sub
transactions, which would let you just enclose possible sticking points in
your transaction in its own box.

But even then, my guess is that as soon as the connection is lost, or you
try to commit without handling the errors (in some not too distant future
with subtrans / error handling) then the transaction will roll back
anyway.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Richard Huxton 2003-07-03 20:28:33 Re: Rollback for aborted function?
Previous Message Andrew Sullivan 2003-07-03 20:01:57 Re: Concatenating two Text fields from the same tuple