ROLLBACK TO SAVEPOINT
– rollback to a savepoint within the current
transaction
ROLLBACK TO SAVEPOINT savepoint-name ;
Rollback all commands that were executed after the savepoint was established. The savepoint remains valid and can be rolled back to again later, if needed.
ROLLBACK TO SAVEPOINT
implicitly destroys all savepoints that
were established after the named savepoint.
START TRANSACTION;
# ...
DECLARE SAVEPOINT f1;
# ...
ROLLBACK TO SAVEPOINT f1;
# ...
ROLLBACK;
START TRANSACTION, COMMIT, ROLLBACK, DECLARE SAVEPOINT, and RELEASE SAVEPOINT.