Re: Nested transactions - Mailing list pgsql-general

From David Fetter
Subject Re: Nested transactions
Date
Msg-id 20091012163033.GF14810@fetter.org
Whole thread Raw
In response to Nested transactions  (Bill Todd <pg@dbginc.com>)
List pgsql-general
On Sun, Oct 11, 2009 at 07:41:54PM -0700, Bill Todd wrote:
> Does PostgreSQL support nested transactions as shown below?
>
> BEGIN;
>  ...do some stuff...
>  BEGIN;
>    ...more stuff...
>  COMMIT;
> COMMIT;

It depends what you want to have happen when the outer transaction
rolls back.  If you want all the sub-commits to roll back, use
SAVEPOINTs.  If you don't, you'll have to write something in an
untrusted PL that uses a separate database connection.

Cheers,
David.
--
David Fetter <david@fetter.org> http://fetter.org/
Phone: +1 415 235 3778  AIM: dfetter666  Yahoo!: dfetter
Skype: davidfetter      XMPP: david.fetter@gmail.com

Remember to vote!
Consider donating to Postgres: http://www.postgresql.org/about/donate

pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: ERROR: simple_heap_delete: tuple already updated by self
Next
From: Ivan Sergio Borgonovo
Date:
Subject: setweight detailed doc was: Ranking search results using multiple fields in PostgreSQL fulltext search