ROLLBACK TO SAVEPOINT -- roll back to a savepoint
ROLLBACK [ WORK ] TO [ SAVEPOINT ] savepoint_name
Roll back 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.
savepoint_name
The savepoint to which to roll back.
Specifying a savepoint name that has not been established is an error.
ROLLBACK TO SAVEPOINT is not supported with SPL programs.
To undo the effects of the commands executed savepoint depts was established:
\set AUTOCOMMIT off INSERT INTO dept VALUES (50, 'HR', 'NEW YORK'); SAVEPOINT depts; INSERT INTO emp (empno, ename, deptno) VALUES (9001, 'JONES', 50); INSERT INTO emp (empno, ename, deptno) VALUES (9002, 'ALICE', 50); ROLLBACK TO SAVEPOINT depts;