2 doc/src/sgml/ref/rollback.sgml
3 PostgreSQL documentation
6 <refentry id=
"sql-rollback">
7 <indexterm zone=
"sql-rollback">
8 <primary>ROLLBACK
</primary>
12 <refentrytitle>ROLLBACK
</refentrytitle>
13 <manvolnum>7</manvolnum>
14 <refmiscinfo>SQL - Language Statements
</refmiscinfo>
18 <refname>ROLLBACK
</refname>
19 <refpurpose>abort the current transaction
</refpurpose>
24 ROLLBACK [ WORK | TRANSACTION ] [ AND [ NO ] CHAIN ]
29 <title>Description
</title>
32 <command>ROLLBACK
</command> rolls back the current transaction and causes
33 all the updates made by the transaction to be discarded.
38 <title>Parameters
</title>
40 <indexterm zone=
"sql-rollback-chain">
41 <primary>chained transactions
</primary>
45 <varlistentry id=
"sql-rollback-transaction">
46 <term><literal>WORK
</literal></term>
47 <term><literal>TRANSACTION
</literal></term>
50 Optional key words. They have no effect.
55 <varlistentry id=
"sql-rollback-chain">
56 <term><literal>AND CHAIN
</literal></term>
59 If
<literal>AND CHAIN
</literal> is specified, a new (not aborted)
60 transaction is immediately started with the same transaction
61 characteristics (see
<xref linkend=
"sql-set-transaction"/>) as the
62 just finished one. Otherwise, no new transaction is started.
73 Use
<link linkend=
"sql-commit"><command>COMMIT
</command></link> to
74 successfully terminate a transaction.
78 Issuing
<command>ROLLBACK
</command> outside of a transaction
79 block emits a warning and otherwise has no effect.
<command>ROLLBACK AND
80 CHAIN
</command> outside of a transaction block is an error.
85 <title>Examples
</title>
91 </programlisting></para>
95 <title>Compatibility
</title>
98 The command
<command>ROLLBACK
</command> conforms to the SQL standard. The
99 form
<literal>ROLLBACK TRANSACTION
</literal> is a PostgreSQL extension.
104 <title>See Also
</title>
106 <simplelist type=
"inline">
107 <member><xref linkend=
"sql-begin"/></member>
108 <member><xref linkend=
"sql-commit"/></member>
109 <member><xref linkend=
"sql-rollback-to"/></member>