X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 4E4833A1D95 for ; Wed, 10 Nov 2004 16:10:06 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 03657-06 for ; Wed, 10 Nov 2004 16:09:52 +0000 (GMT) Received: from mail.gmx.net (imap.gmx.net [213.165.64.20]) by svr1.postgresql.org (Postfix) with SMTP id EC37D3A421C for ; Wed, 10 Nov 2004 16:09:50 +0000 (GMT) Received: (qmail 25672 invoked by uid 65534); 10 Nov 2004 16:09:49 -0000 Received: from dsl-082-082-234-251.arcor-ip.net (EHLO colt.pezone.net) (82.82.234.251) by mail.gmx.net (mp020) with SMTP; 10 Nov 2004 17:09:49 +0100 X-Authenticated: #495269 From: Peter Eisentraut To: Achilleus Mantzios Subject: Re: A transaction in transaction? Possible? Date: Wed, 10 Nov 2004 17:09:48 +0100 User-Agent: KMail/1.5.1 Cc: pgsql-sql@postgresql.org References: In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-7" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200411101709.48968.peter_e@gmx.net> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200411/106 X-Sequence-Number: 19425 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/