At update of non-LP_NORMAL TID, fail instead of corrupting page header.
[pgsql.git] / doc / src / sgml / ref / rollback_prepared.sgml
blob175a3e93863f42974e06d6695c008f471ef24f5e
1 <!--
2 doc/src/sgml/ref/rollback_prepared.sgml
3 PostgreSQL documentation
4 -->
6 <refentry id="sql-rollback-prepared">
7 <indexterm zone="sql-rollback-prepared">
8 <primary>ROLLBACK PREPARED</primary>
9 </indexterm>
11 <refmeta>
12 <refentrytitle>ROLLBACK PREPARED</refentrytitle>
13 <manvolnum>7</manvolnum>
14 <refmiscinfo>SQL - Language Statements</refmiscinfo>
15 </refmeta>
17 <refnamediv>
18 <refname>ROLLBACK PREPARED</refname>
19 <refpurpose>cancel a transaction that was earlier prepared for two-phase commit</refpurpose>
20 </refnamediv>
22 <refsynopsisdiv>
23 <synopsis>
24 ROLLBACK PREPARED <replaceable class="parameter">transaction_id</replaceable>
25 </synopsis>
26 </refsynopsisdiv>
28 <refsect1>
29 <title>Description</title>
31 <para>
32 <command>ROLLBACK PREPARED</command> rolls back a transaction that is in
33 prepared state.
34 </para>
35 </refsect1>
37 <refsect1>
38 <title>Parameters</title>
40 <variablelist>
41 <varlistentry>
42 <term><replaceable class="parameter">transaction_id</replaceable></term>
43 <listitem>
44 <para>
45 The transaction identifier of the transaction that is to be
46 rolled back.
47 </para>
48 </listitem>
49 </varlistentry>
50 </variablelist>
51 </refsect1>
53 <refsect1>
54 <title>Notes</title>
56 <para>
57 To roll back a prepared transaction, you must be either the same user that
58 executed the transaction originally, or a superuser. But you do not
59 have to be in the same session that executed the transaction.
60 </para>
62 <para>
63 This command cannot be executed inside a transaction block. The prepared
64 transaction is rolled back immediately.
65 </para>
67 <para>
68 All currently available prepared transactions are listed in the
69 <link linkend="view-pg-prepared-xacts"><structname>pg_prepared_xacts</structname></link>
70 system view.
71 </para>
72 </refsect1>
74 <refsect1 id="sql-rollback-prepared-examples">
75 <title>Examples</title>
76 <para>
77 Roll back the transaction identified by the transaction
78 identifier <literal>foobar</literal>:
80 <programlisting>
81 ROLLBACK PREPARED 'foobar';
82 </programlisting></para>
84 </refsect1>
86 <refsect1>
87 <title>Compatibility</title>
89 <para>
90 <command>ROLLBACK PREPARED</command> is a
91 <productname>PostgreSQL</productname> extension. It is intended for use by
92 external transaction management systems, some of which are covered by
93 standards (such as X/Open XA), but the SQL side of those systems is not
94 standardized.
95 </para>
96 </refsect1>
98 <refsect1>
99 <title>See Also</title>
101 <simplelist type="inline">
102 <member><xref linkend="sql-prepare-transaction"/></member>
103 <member><xref linkend="sql-commit-prepared"/></member>
104 </simplelist>
105 </refsect1>
107 </refentry>