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/ ---------------------------(end of broadcast)--------------------------- TIP 8: explain analyze is your friend