ROLLBACK TO SAVEPOINT

From: Sam Vilain <sam(at)vilain(dot)net>
To: pgsql-hackers(at)postgresql(dot)org
Subject: ROLLBACK TO SAVEPOINT
Date: 2010-05-25 04:08:38
Message-ID: 4BFB4D46.9050400@vilain.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

The note at the end of;

http://www.postgresql.org/docs/8.4/static/sql-savepoint.html

Lead us to believe that if you roll back to the same savepoint name
twice in a row, that you might start walking back through the
savepoints. I guess I missed the note on ROLLBACK TO SAVEPOINT that
that is not how it works.

Here is the section:

SQL requires a savepoint to be destroyed automatically when another
savepoint with the same name is established. In PostgreSQL, the old
savepoint is kept, though only the more recent one will be used when
rolling back or releasing. (Releasing the newer savepoint will cause the
older one to again become accessible to ROLLBACK TO SAVEPOINT and
RELEASE SAVEPOINT.) Otherwise, SAVEPOINT is fully SQL conforming.

I think it could be improved by also communicating:

Rollback to a savepoint never releases it; you can safely repeat
ROLLBACK TO SAVEPOINT statements without unwinding the transaction, even
if you are re-using savepoint names.

Well, maybe no-one else will ever have the misconception I did, but
there it is.

Sam.

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Fujii Masao 2010-05-25 04:50:43 Re: Synchronization levels in SR
Previous Message Tom Lane 2010-05-25 04:03:01 Re: unnailing shared relations (was Re: global temporary tables)