pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Peter Eisentraut <peter_e@gmx.net>
To: Achilleus Mantzios <achill@matrix.gatewaynet.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: A transaction in transaction? Possible?
Date: Wed, 10 Nov 2004 17:09:48 +0100
Message-ID: <200411101709.48968.peter_e@gmx.net> (raw)
In-Reply-To: <Pine.LNX.4.44.0411101756450.7535-100000@matrix.gatewaynet.com>
References: <Pine.LNX.4.44.0411101756450.7535-100000@matrix.gatewaynet.com>

Achilleus Mantzios wrote:
> In other words, now with savepoints, BEGIN; COMMIT; ROLLBACK;
> can be replaced with
> SAVEPOINT foo; RELEASE foo; ROLLBACK TO foo; respectively.
>
> If only transactions weren't a requirement for SAVEPOINTs,
> what would we then need BEGIN; COMMIT; ROLLBACK; for?

Note that under the current arrangement, it doesn't make much sense to 
"commit" a subtransaction.  It will be committed anyway when the main 
transactions commits, and you cannot commit it earlier because the main 
transaction could still roll back.  So savepoint blocks are not really 
transactions, but more like semi-transactions.

In other nested transaction models, things can be different.  If you 
have so-called open nested transactions, which expose their results to 
other transactions already before the parent transaction commits, then 
a subtransaction commit is useful.  But that behavior violates the 
isolation criterion of transactions and therefore needs additional 
facilities to behave tolerably.

-- 
Peter Eisentraut
http://developer.postgresql.org/~petere/




view thread (18+ messages)  latest in thread

Message-ID: <200411101709.48968.peter_e@gmx.net>
Permalink:  ../200411101709.48968.peter_e@gmx.net/
Also on:    postgresql.org/message-id/200411101709.48968.peter_e@gmx.net

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: peter_e@gmx.net, achill@matrix.gatewaynet.com
  Subject: Re: A transaction in transaction? Possible?
  In-Reply-To: <200411101709.48968.peter_e@gmx.net>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox