1RELEASE SAVEPOINT(7) PostgreSQL 11.6 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 one that was most
37 recently defined is released.
38
40 To establish and later destroy a savepoint:
41
42 BEGIN;
43 INSERT INTO table1 VALUES (3);
44 SAVEPOINT my_savepoint;
45 INSERT INTO table1 VALUES (4);
46 RELEASE SAVEPOINT my_savepoint;
47 COMMIT;
48
49 The above transaction will insert both 3 and 4.
50
52 This command conforms to the SQL standard. The standard specifies that
53 the key word SAVEPOINT is mandatory, but PostgreSQL allows it to be
54 omitted.
55
57 BEGIN(7), COMMIT(7), ROLLBACK(7), ROLLBACK TO SAVEPOINT
58 (ROLLBACK_TO_SAVEPOINT(7)), SAVEPOINT(7)
59
60
61
62PostgreSQL 11.6 2019 RELEASE SAVEPOINT(7)