1 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>ROLLBACK PREPARED</title><link rel="stylesheet" type="text/css" href="stylesheet.css" /><link rev="made" href="pgsql-docs@lists.postgresql.org" /><meta name="generator" content="DocBook XSL Stylesheets Vsnapshot" /><link rel="prev" href="sql-rollback.html" title="ROLLBACK" /><link rel="next" href="sql-rollback-to.html" title="ROLLBACK TO SAVEPOINT" /></head><body id="docContent" class="container-fluid col-10"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="5" align="center">ROLLBACK PREPARED</th></tr><tr><td width="10%" align="left"><a accesskey="p" href="sql-rollback.html" title="ROLLBACK">Prev</a> </td><td width="10%" align="left"><a accesskey="u" href="sql-commands.html" title="SQL Commands">Up</a></td><th width="60%" align="center">SQL Commands</th><td width="10%" align="right"><a accesskey="h" href="index.html" title="PostgreSQL 18.0 Documentation">Home</a></td><td width="10%" align="right"> <a accesskey="n" href="sql-rollback-to.html" title="ROLLBACK TO SAVEPOINT">Next</a></td></tr></table><hr /></div><div class="refentry" id="SQL-ROLLBACK-PREPARED"><div class="titlepage"></div><a id="id-1.9.3.168.1" class="indexterm"></a><div class="refnamediv"><h2><span class="refentrytitle">ROLLBACK PREPARED</span></h2><p>ROLLBACK PREPARED — cancel a transaction that was earlier prepared for two-phase commit</p></div><div class="refsynopsisdiv"><h2>Synopsis</h2><pre class="synopsis">
3 ROLLBACK PREPARED <em class="replaceable"><code>transaction_id</code></em>
4 </pre></div><div class="refsect1" id="id-1.9.3.168.5"><h2>Description</h2><p>
5 <code class="command">ROLLBACK PREPARED</code> rolls back a transaction that is in
7 </p></div><div class="refsect1" id="id-1.9.3.168.6"><h2>Parameters</h2><div class="variablelist"><dl class="variablelist"><dt><span class="term"><em class="replaceable"><code>transaction_id</code></em></span></dt><dd><p>
8 The transaction identifier of the transaction that is to be
10 </p></dd></dl></div></div><div class="refsect1" id="id-1.9.3.168.7"><h2>Notes</h2><p>
11 To roll back a prepared transaction, you must be either the same user that
12 executed the transaction originally, or a superuser. But you do not
13 have to be in the same session that executed the transaction.
15 This command cannot be executed inside a transaction block. The prepared
16 transaction is rolled back immediately.
18 All currently available prepared transactions are listed in the
19 <a class="link" href="view-pg-prepared-xacts.html" title="53.17. pg_prepared_xacts"><code class="structname">pg_prepared_xacts</code></a>
21 </p></div><div class="refsect1" id="SQL-ROLLBACK-PREPARED-EXAMPLES"><h2>Examples</h2><p>
22 Roll back the transaction identified by the transaction
23 identifier <code class="literal">foobar</code>:
25 </p><pre class="programlisting">
26 ROLLBACK PREPARED 'foobar';
27 </pre></div><div class="refsect1" id="id-1.9.3.168.9"><h2>Compatibility</h2><p>
28 <code class="command">ROLLBACK PREPARED</code> is a
29 <span class="productname">PostgreSQL</span> extension. It is intended for use by
30 external transaction management systems, some of which are covered by
31 standards (such as X/Open XA), but the SQL side of those systems is not
33 </p></div><div class="refsect1" id="id-1.9.3.168.10"><h2>See Also</h2><span class="simplelist"><a class="xref" href="sql-prepare-transaction.html" title="PREPARE TRANSACTION"><span class="refentrytitle">PREPARE TRANSACTION</span></a>, <a class="xref" href="sql-commit-prepared.html" title="COMMIT PREPARED"><span class="refentrytitle">COMMIT PREPARED</span></a></span></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="sql-rollback.html" title="ROLLBACK">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="sql-commands.html" title="SQL Commands">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="sql-rollback-to.html" title="ROLLBACK TO SAVEPOINT">Next</a></td></tr><tr><td width="40%" align="left" valign="top">ROLLBACK </td><td width="20%" align="center"><a accesskey="h" href="index.html" title="PostgreSQL 18.0 Documentation">Home</a></td><td width="40%" align="right" valign="top"> ROLLBACK TO SAVEPOINT</td></tr></table></div></body></html>