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