Diagnostic Queries
Symptoms
A RELEASE SAVEPOINT was issued outside an explicit transaction block. PostgreSQL raises SQLSTATE 25P01 (no_active_sql_transaction).
- RELEASE SAVEPOINT used with no open transaction.
- Savepoints exist only inside a transaction.
- Common when BEGIN is missing or already committed.
What the server log shows
ERROR: RELEASE SAVEPOINT can only be used in transaction blocks
Why PostgreSQL raises this — what the manual says
As the RELEASE SAVEPOINT reference (Description) explains:
RELEASE SAVEPOINT is only meaningful inside a transaction block, because savepoints exist only within an explicit transaction; issue it between BEGIN and COMMIT, after a matching SAVEPOINT command.
Releasing a savepoint operates on transaction state. With no active transaction, there is no savepoint to release, so PostgreSQL reports 25P01.
Common causes
- Issuing RELEASE SAVEPOINT without a transaction open.
- Autocommit mode.
- The transaction was already committed/rolled back.
How to fix it
- Ensure a transaction is open (
BEGIN) and the savepoint exists. - Release the savepoint before committing the transaction.
- Disable autocommit where savepoints are used.
Related & next steps
Reference: PostgreSQL 18 — RELEASE SAVEPOINT.
Thanks — noted. This helps keep the database accurate.