Re: Nested transactions

From: David Fetter <david(at)fetter(dot)org>
To: Bill Todd <pg(at)dbginc(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Nested transactions
Date: 2009-10-12 16:30:33
Message-ID: 20091012163033.GF14810@fetter.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)fetter(dot)org> http://fetter.org/
Phone: +1 415 235 3778 AIM: dfetter666 Yahoo!: dfetter
Skype: davidfetter XMPP: david(dot)fetter(at)gmail(dot)com

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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Ivan Sergio Borgonovo 2009-10-12 16:37:40 setweight detailed doc was: Ranking search results using multiple fields in PostgreSQL fulltext search
Previous Message Tom Lane 2009-10-12 16:13:12 Re: ERROR: simple_heap_delete: tuple already updated by self