]> begriffs open source - ai-pg/blob - full-docs/man7/ROLLBACK.7
Convert HTML docs to more streamlined TXT
[ai-pg] / full-docs / man7 / ROLLBACK.7
1 '\" t
2 .\"     Title: ROLLBACK
3 .\"    Author: The PostgreSQL Global Development Group
4 .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/>
5 .\"      Date: 2025
6 .\"    Manual: PostgreSQL 18.0 Documentation
7 .\"    Source: PostgreSQL 18.0
8 .\"  Language: English
9 .\"
10 .TH "ROLLBACK" "7" "2025" "PostgreSQL 18.0" "PostgreSQL 18.0 Documentation"
11 .\" -----------------------------------------------------------------
12 .\" * Define some portability stuff
13 .\" -----------------------------------------------------------------
14 .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
15 .\" http://bugs.debian.org/507673
16 .\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
17 .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
18 .ie \n(.g .ds Aq \(aq
19 .el       .ds Aq '
20 .\" -----------------------------------------------------------------
21 .\" * set default formatting
22 .\" -----------------------------------------------------------------
23 .\" disable hyphenation
24 .nh
25 .\" disable justification (adjust text to left margin only)
26 .ad l
27 .\" -----------------------------------------------------------------
28 .\" * MAIN CONTENT STARTS HERE *
29 .\" -----------------------------------------------------------------
30 .SH "NAME"
31 ROLLBACK \- abort the current transaction
32 .SH "SYNOPSIS"
33 .sp
34 .nf
35 ROLLBACK [ WORK | TRANSACTION ] [ AND [ NO ] CHAIN ]
36 .fi
37 .SH "DESCRIPTION"
38 .PP
39 \fBROLLBACK\fR
40 rolls back the current transaction and causes all the updates made by the transaction to be discarded\&.
41 .SH "PARAMETERS"
42 .PP
43 WORK
44 .br
45 TRANSACTION
46 .RS 4
47 Optional key words\&. They have no effect\&.
48 .RE
49 .PP
50 AND CHAIN
51 .RS 4
52 If
53 AND CHAIN
54 is specified, a new (not aborted) transaction is immediately started with the same transaction characteristics (see
55 SET TRANSACTION (\fBSET_TRANSACTION\fR(7))) as the just finished one\&. Otherwise, no new transaction is started\&.
56 .RE
57 .SH "NOTES"
58 .PP
59 Use
60 \fBCOMMIT\fR
61 to successfully terminate a transaction\&.
62 .PP
63 Issuing
64 \fBROLLBACK\fR
65 outside of a transaction block emits a warning and otherwise has no effect\&.
66 \fBROLLBACK AND CHAIN\fR
67 outside of a transaction block is an error\&.
68 .SH "EXAMPLES"
69 .PP
70 To abort all changes:
71 .sp
72 .if n \{\
73 .RS 4
74 .\}
75 .nf
76 ROLLBACK;
77 .fi
78 .if n \{\
79 .RE
80 .\}
81 .SH "COMPATIBILITY"
82 .PP
83 The command
84 \fBROLLBACK\fR
85 conforms to the SQL standard\&. The form
86 ROLLBACK TRANSACTION
87 is a PostgreSQL extension\&.
88 .SH "SEE ALSO"
89 \fBBEGIN\fR(7), \fBCOMMIT\fR(7), ROLLBACK TO SAVEPOINT (\fBROLLBACK_TO_SAVEPOINT\fR(7))