RELEASE_SAVEPOINT(7pg13)
πΈ NAME πΈ
hey bestie π this is the RELEASE_SAVEPOINT(7pg13) page from the PostgreSQL 13.23 Documentation, and it's literally about how to destroy a previously defined savepoint. no cap.
β¨ SYNOPSIS β¨
RELEASE [ SAVEPOINT ] savepoint_name
π DESCRIPTION π
okay so RELEASE SAVEPOINT destroys a savepoint that you previously defined in the current transaction. iconic cleanup behavior, honestly.
Destroying a savepoint makes it unavailable as a rollback point, but it has no other user visible behavior. it does not undo the effects of commands executed after the savepoint was established. (to do that, see ROLLBACK TO SAVEPOINT (ROLLBACK_TO_SAVEPOINT(7)).) destroying a savepoint when it is no longer needed allows the system to reclaim some resources earlier than transaction end. love that for your resources π«Ά
RELEASE SAVEPOINT also destroys all savepoints that were established after the named savepoint was established. yes bestie, it takes the whole little savepoint entourage with it π
π PARAMETERS π
savepoint_nameβ the name of the savepoint to destroy. that's the one, periodt.
π¦ NOTES π¦
- specifying a savepoint name that was not previously defined is an error. rude? maybe. but valid.
- it is not possible to release a savepoint when the transaction is in an aborted state. literally can't do it.
- if multiple savepoints have the same name, only the most recently defined unreleased one is released. repeated commands will release progressively older savepoints. so it's giving "last in, first released" energy β¨
π EXAMPLES π
to establish and later destroy a savepoint:
BEGIN;
INSERT INTO table1 VALUES (3);
SAVEPOINT my_savepoint;
INSERT INTO table1 VALUES (4);
RELEASE SAVEPOINT my_savepoint;
COMMIT;
the above transaction will insert both 3 and 4. ate.
π COMPATIBILITY π
this command conforms to the SQL standard. the standard specifies that the key word SAVEPOINT is mandatory, but PostgreSQL allows it to be omitted. PostgreSQL being flexible? we love to see it π
π§ SEE ALSO π§
BEGIN(7)COMMIT(7)ROLLBACK(7)ROLLBACK TO SAVEPOINT(ROLLBACK_TO_SAVEPOINT(7))SAVEPOINT(7)
and that's the PostgreSQL 13.23 docs, dated 2025, signing off πβ¨
π¦ where this page comes from
- opensuse-leap 16.0: postgresql13 13.23-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql13 13.23-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql13 13.23-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql13 13.23-160000.1.1 Β· PostgreSQL
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms