PostgreSQL
postgresql.org › docs › current › sql-rollback-to.html
PostgreSQL: Documentation: 18: ROLLBACK TO SAVEPOINT
May 14, 2026 - 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.
PostgreSQL
postgresql.org › docs › current › sql-savepoint.html
PostgreSQL: Documentation: 18: SAVEPOINT
May 14, 2026 - BEGIN; INSERT INTO table1 VALUES (1); SAVEPOINT my_savepoint; INSERT INTO table1 VALUES (2); SAVEPOINT my_savepoint; INSERT INTO table1 VALUES (3); -- rollback to the second savepoint ROLLBACK TO SAVEPOINT my_savepoint; SELECT * FROM table1; -- shows rows 1 and 2 -- release the second savepoint RELEASE SAVEPOINT my_savepoint; -- rollback to the first savepoint ROLLBACK TO SAVEPOINT my_savepoint; SELECT * FROM table1; -- shows only row 1 COMMIT;
PostgreSQL
postgresql.org › docs › 17 › sql-rollback-to.html
PostgreSQL: Documentation: 17: ROLLBACK TO SAVEPOINT
May 14, 2026 - 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.
PostgreSQL
postgresql.org › docs › 15 › sql-rollback-to.html
PostgreSQL: Documentation: 15: ROLLBACK TO SAVEPOINT
November 13, 2025 - 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.
PostgreSQL
postgresql.org › docs › 14 › sql-rollback-to.html
PostgreSQL: Documentation: 14: ROLLBACK TO SAVEPOINT
May 14, 2026 - 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.
PostgreSQL
postgresql.org › docs › 9.1 › static › sql-rollback-to.html
PostgreSQL: Documentation: 9.1: ROLLBACK TO SAVEPOINT
October 27, 2016 - 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.
PostgreSQL
postgresql.org › docs › 10 › sql-rollback-to.html
PostgreSQL: Documentation: 10: ROLLBACK TO SAVEPOINT
November 10, 2022 - 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.
Bytebase
bytebase.com › blog › guides › postgres rollback explained
Postgres Rollback Explained | Bytebase
September 4, 2025 - BEGIN; -- Step 1: safe operations INSERT INTO employees (name, department) VALUES ('Alice', 'Engineering'); SAVEPOINT sp_batch; -- Step 2: risky operations INSERT INTO employees (name, department) VALUES ('Bob', 'Marketing'); -- Oops, Bob is actually in Sales -- Roll back only the risky step ROLLBACK TO SAVEPOINT sp_batch; -- Step 3: continue with corrected operation INSERT INTO employees (name, department) VALUES ('Bob', 'Sales'); COMMIT;
PostgreSQL
postgresql.org › docs › 13 › sql-rollback-to.html
PostgreSQL: Documentation: 13: ROLLBACK TO SAVEPOINT
August 14, 2025 - 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.
PostgreSQL
postgresql.org › docs › 8.2 › sql-rollback-to.html
PostgreSQL: Documentation: 8.2: ROLLBACK TO SAVEPOINT
December 5, 2011 - 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.
pgPedia
pgpedia.info › r › rollback-to-savepoint.html
ROLLBACK TO SAVEPOINT - pgPedia - a PostgreSQL Encyclopedia
PostgreSQL documentation PostgreSQL feature matrix PostgreSQL versioning policy PostgreSQL latest versions @pgpedia.info (Bluesky) ... ROLLBACK TO SAVEPOINT is a transaction command for rolling back a transaction to a previously defined savepoint.
PostgreSQL
postgresql.org › docs › 11 › sql-rollback-to.html
PostgreSQL: Documentation: 11: ROLLBACK TO SAVEPOINT
November 9, 2023 - 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.
PostgreSQL
postgresql.org › docs › 9.6 › sql-rollback-to.html
PostgreSQL: Documentation: 9.6: ROLLBACK TO SAVEPOINT
August 12, 2021 - 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.
PostgreSQL
postgresql.org › docs › 9.4 › sql-savepoint.html
PostgreSQL: Documentation: 9.4: SAVEPOINT
February 13, 2020 - The name to give to the new savepoint. Use ROLLBACK TO SAVEPOINT to rollback to a savepoint.
PostgreSQL
postgresql.org › docs › current › sql-release-savepoint.html
PostgreSQL: Documentation: 18: RELEASE SAVEPOINT
May 14, 2026 - When the statement attempting to insert value 4 generates an error, the insertion of 2 and 4 are lost because they are in the same, now-rolled back savepoint, and value 3 is in the same transaction context. The application can now only choose one of these two commands, since all other commands will be ignored: ... Choosing ROLLBACK will abort everything, including value 1, whereas ROLLBACK TO SAVEPOINT sp1 will retain value 1 and allow the transaction to continue.
Top answer 1 of 2
2
Just found this :
In PL/pgSQL, when an exception is caught by an EXCEPTION clause, all database changes since the block's BEGIN are automatically rolled back. if you are translating an Oracle procedure that uses SAVEPOINT and ROLLBACK TO in this style, your task is easy: just omit the SAVEPOINT and ROLLBACK TO
source : https://www.postgresql.org/docs/10/plpgsql-porting.html.
2 of 2
1
It looks like a PL/pgSQL syntax limitation: you can create savepoint but you cannot use 'ROLLBACK TO savepoint' statement. I have not found this limitation in the documentation although documentation says that cannot run ROLLBACK in a exception block:
Stack Overflow
stackoverflow.com › questions › 18756118 › rollback-to-specific-savepoint-in-postgresql
Rollback to specific savepoint in postgresql - Stack Overflow
INSERT ....; SAVEPOINT foo; UPDATE ....; ROLLBACK TO SAVEPOINT foo, postgresql.org/docs/8.1/static/sql-savepoint.html, or you forgot to specify programming language