Back to Yugabyte Db

RELEASE SAVEPOINT statement [YSQL]

docs/content/v2024.1/api/ysql/the-sql-language/statements/savepoint_release.md

2026.1.0.0-b251014 B
Original Source

Synopsis

Use the RELEASE SAVEPOINT statement to release the server-side state associated with tracking a savepoint and make the named savepoint no longer accessible to ROLLBACK TO.

Syntax

{{%ebnf%}} savepoint_release {{%/ebnf%}}

Semantics

release

plpgsql
RELEASE [ SAVEPOINT ] name

NAME

The name of the savepoint you wish to release.

{{<note title="Other savepoints may be released">}} When you release a savepoint, all savepoints that were created after it was created are also released. {{</note>}}

Examples

Begin a transaction and create a savepoint.

plpgsql
BEGIN TRANSACTION;
SAVEPOINT test;

Once you are done with it, release the savepoint:

plpgsql
RELEASE test;

If at this point, you attempt to rollback to test, it will be an error:

plpgsql
ROLLBACK TO test;
output
ERROR:  savepoint "test" does not exist

See also