Complete worked example
sql
BEGIN;
UPDATE roles SET active=0 WHERE id=1 AND active=1;
SELECT 'inside' AS checkpoint,id,active FROM roles WHERE id=1;
ROLLBACK;
SELECT 'after' AS checkpoint,id,active FROM roles WHERE id=1;- Reasoning
- Both intermediate change and final restoration are observed.