1RELEASE SAVEPOINT(7) PostgreSQL 15.4 Documentation RELEASE SAVEPOINT(7)
2
3
4
6 RELEASE_SAVEPOINT - destroy a previously defined savepoint
7
9 RELEASE [ SAVEPOINT ] savepoint_name
10
12 RELEASE SAVEPOINT destroys a savepoint previously defined in the
13 current transaction.
14
15 Destroying a savepoint makes it unavailable as a rollback point, but it
16 has no other user visible behavior. It does not undo the effects of
17 commands executed after the savepoint was established. (To do that, see
18 ROLLBACK TO SAVEPOINT (ROLLBACK_TO_SAVEPOINT(7)).) Destroying a
19 savepoint when it is no longer needed allows the system to reclaim some
20 resources earlier than transaction end.
21
22 RELEASE SAVEPOINT also destroys all savepoints that were established
23 after the named savepoint was established.
24
26 savepoint_name
27 The name of the savepoint to destroy.
28
30 Specifying a savepoint name that was not previously defined is an
31 error.
32
33 It is not possible to release a savepoint when the transaction is in an
34 aborted state.
35
36 If multiple savepoints have the same name, only the most recently
37 defined unreleased one is released. Repeated commands will release
38 progressively older savepoints.
39
41 To establish and later destroy a savepoint:
42
43 BEGIN;
44 INSERT INTO table1 VALUES (3);
45 SAVEPOINT my_savepoint;
46 INSERT INTO table1 VALUES (4);
47 RELEASE SAVEPOINT my_savepoint;
48 COMMIT;
49
50 The above transaction will insert both 3 and 4.
51
53 This command conforms to the SQL standard. The standard specifies that
54 the key word SAVEPOINT is mandatory, but PostgreSQL allows it to be
55 omitted.
56
58 BEGIN(7), COMMIT(7), ROLLBACK(7), ROLLBACK TO SAVEPOINT
59 (ROLLBACK_TO_SAVEPOINT(7)), SAVEPOINT(7)
60
61
62
63PostgreSQL 15.4 2023 RELEASE SAVEPOINT(7)