Re: SAVEPOINT and FOR UPDATE

From: Gregory Stark <gsstark(at)mit(dot)edu>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "Thomas F(dot) O'Connell" <tfo(at)sitening(dot)com>, PgSQL-General <pgsql-general(at)postgresql(dot)org>
Subject: Re: SAVEPOINT and FOR UPDATE
Date: 2006-08-04 23:01:03
Message-ID: 87vep8qf68.fsf@stark.xeocode.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> writes:

> "Thomas F. O'Connell" <tfo(at)sitening(dot)com> writes:
> > I sort of expected the release of the savepoint to be tantamount to a
> > commit of the subtransaction, but it doesn't appear to have been.
>
> But you still haven't committed the outer transaction: rolling it back
> must undo the effects of the subtransaction, no? So a "release" merely
> destroys the separate identity of the subtransaction and assigns all its
> effects (including locks) to the parent transaction.

There seems to be a recurring confusion between subtransactions and autonomous
transactions. Perhaps there should be a caveat in the SAVEPOINT documentation
explaining that they aren't autonomous transactions and the work inside the
savepoint is still subject to the regular transaction semantics for the
outermost transaction and isn't actually committed until the outer transaction
commits.

--
Gregory Stark
EnterpriseDB http://www.enterprisedb.com

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Germán Hüttemann Arza 2006-08-05 10:44:04 PostgreSQL Internals
Previous Message Matthew T. O'Connor 2006-08-04 22:05:05 Re: PITR Questions