Michael Paesold wrote:

BEGIN;
SAVEPOINT a;
INSERT INTO ...
SAVEPOINT a;
INSERT INTO ...
SAVEPOINT a;
...
(encountering an error it would just ROLLBACK TO a;)

According to the standard this is exactly the same as:

BEGIN;
SAVEPOINT a;
INSERT INTO ...
RELEASE SAVEPOINT a;
SAVEPOINT a;
INSERT INTO ...

While that's true in this particular case, you can't do that transformation in the general case. Consider:


BEGIN
SAVEPOINT a
 -- work
SAVEPOINT b
 -- work
SAVEPOINT a
 -- work
ROLLBACK TO b
 -- work

This is valid: the standard says that the second "SAVEPOINT a" destroys and recreates the savepoint "a", but doesn't say that it destroys intervening savepoints. In contrast, RELEASE SAVEPOINT explicitly says that it destroys the specified savepoint and all savepoints established since the specified savepoint.

If you converted the second "SAVEPOINT a" into "RELEASE SAVEPOINT a; SAVEPOINT a" then savepoint "b" would be incorrectly destroyed.

It'd work for the (common?) case where there are no intervening savepoints, though.

-O

---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
     subscribe-nomail command to [EMAIL PROTECTED] so that your
     message can get through to the mailing list cleanly

Reply via email to