PostgreSQL error code
PostgreSQL error 3B001
3B001 is the SQLSTATE PostgreSQL reports for invalid savepoint specification, in class 3B, Savepoint Exception.
| SQLSTATE | 3B001 |
|---|---|
| Condition name | invalid_savepoint_specification |
| Class | 3B — Savepoint Exception |
Reproduce it, then fix it
You can only roll back to a savepoint that was set earlier in the same transaction. Run the broken query to see the error, then switch to the fixed one. Edit either freely; every run is rolled back.
ROLLBACK TO SAVEPOINT before_update;
SAVEPOINT before_update; UPDATE products SET price = 0; ROLLBACK TO SAVEPOINT before_update; SELECT id, price FROM products ORDER BY id LIMIT 3;