1<!-- 2doc/src/sgml/ref/abort.sgml 3PostgreSQL documentation 4--> 5 6<refentry id="sql-abort"> 7 <indexterm zone="sql-abort"> 8 <primary>ABORT</primary> 9 </indexterm> 10 11 <refmeta> 12 <refentrytitle>ABORT</refentrytitle> 13 <manvolnum>7</manvolnum> 14 <refmiscinfo>SQL - Language Statements</refmiscinfo> 15 </refmeta> 16 17 <refnamediv> 18 <refname>ABORT</refname> 19 <refpurpose>abort the current transaction</refpurpose> 20 </refnamediv> 21 22 <refsynopsisdiv> 23<synopsis> 24ABORT [ WORK | TRANSACTION ] [ AND [ NO ] CHAIN ] 25</synopsis> 26 </refsynopsisdiv> 27 28 <refsect1> 29 <title>Description</title> 30 31 <para> 32 <command>ABORT</command> rolls back the current transaction and causes 33 all the updates made by the transaction to be discarded. 34 This command is identical 35 in behavior to the standard <acronym>SQL</acronym> command 36 <xref linkend="sql-rollback"/>, 37 and is present only for historical reasons. 38 </para> 39 </refsect1> 40 41 <refsect1> 42 <title>Parameters</title> 43 44 <variablelist> 45 <varlistentry> 46 <term><literal>WORK</literal></term> 47 <term><literal>TRANSACTION</literal></term> 48 <listitem> 49 <para> 50 Optional key words. They have no effect. 51 </para> 52 </listitem> 53 </varlistentry> 54 55 <varlistentry> 56 <term><literal>AND CHAIN</literal></term> 57 <listitem> 58 <para> 59 If <literal>AND CHAIN</literal> is specified, a new transaction is 60 immediately started with the same transaction characteristics (see <xref 61 linkend="sql-set-transaction"/>) as the just finished one. Otherwise, 62 no new transaction is started. 63 </para> 64 </listitem> 65 </varlistentry> 66 </variablelist> 67 </refsect1> 68 69 <refsect1> 70 <title>Notes</title> 71 72 <para> 73 Use <xref linkend="sql-commit"/> to 74 successfully terminate a transaction. 75 </para> 76 77 <para> 78 Issuing <command>ABORT</command> outside of a transaction block 79 emits a warning and otherwise has no effect. 80 </para> 81 </refsect1> 82 83 <refsect1> 84 <title>Examples</title> 85 86 <para> 87 To abort all changes: 88<programlisting> 89ABORT; 90</programlisting></para> 91 </refsect1> 92 93 <refsect1> 94 <title>Compatibility</title> 95 96 <para> 97 This command is a <productname>PostgreSQL</productname> extension 98 present for historical reasons. <command>ROLLBACK</command> is the 99 equivalent standard SQL command. 100 </para> 101 </refsect1> 102 103 <refsect1> 104 <title>See Also</title> 105 106 <simplelist type="inline"> 107 <member><xref linkend="sql-begin"/></member> 108 <member><xref linkend="sql-commit"/></member> 109 <member><xref linkend="sql-rollback"/></member> 110 </simplelist> 111 </refsect1> 112</refentry> 113