arbitrary identifier that later identifies this transaction for
<command>COMMIT PREPARED</command> or <command>ROLLBACK PREPARED</command>.
The identifier must be written as a string literal, and must be
less than 200 bytes long. It must not be the same as the identifier
used for any currently prepared transaction.
</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1>
<title>Notes</title>
<para>
<command>PREPARE TRANSACTION</command> is not intended for use in applications
or interactive sessions. Its purpose is to allow an external
transaction manager to perform atomic global transactions across multiple
databases or other transactional resources. Unless you're writing a
transaction manager, you probably shouldn't be using <command>PREPARE
TRANSACTION</command>.
</para>
<para>
This command must be used inside a transaction block. Use <link
linkend="sql-begin"><command>BEGIN</command></link> to start one.
</para>
<para>
It is not currently allowed to <command>PREPARE</command> a transaction that
has executed any operations involving temporary tables or the session's
temporary namespace, created any cursors <literal>WITH HOLD</literal>, or
executed <command>LISTEN</command>, <command>UNLISTEN</command>, or
<command>NOTIFY</command>.
Those features are too tightly
tied to the current session to be useful in a transaction to be prepared.
</para>
<para>
If the transaction modified any run-time parameters with <command>SET</command>
(without the <literal>LOCAL</literal> option),
those effects persist after <command>PREPARE TRANSACTION</command>, and will not
be affected by any later <command>COMMIT PREPARED</command> or
<command>ROLLBACK PREPARED</command>. Thus, in this one respect
<command>PREPARE TRANSACTION</command> acts more like <command>COMMIT</command> than
<command>ROLLBACK</command>.
</para>
<para>
All currently available prepared transactions are listed in the
<link linkend="view-pg-prepared-xacts"><structname>pg_prepared_xacts</structname></link>