<listitem>
<para>
The primary error message and associated SQLSTATE code for the most
recent failed query in the current <application>psql</application> session, or
an empty string and <literal>00000</literal> if no error has occurred in
the current session.
</para>
</listitem>
</varlistentry>
<varlistentry id="app-psql-variables-on-error-rollback">
<term>
<varname>ON_ERROR_ROLLBACK</varname>
<indexterm>
<primary>rollback</primary>
<secondary>psql</secondary>
</indexterm>
</term>
<listitem>
<para>
When set to <literal>on</literal>, if a statement in a transaction block
generates an error, the error is ignored and the transaction
continues. When set to <literal>interactive</literal>, such errors are only
ignored in interactive sessions, and not when reading script
files. When set to <literal>off</literal> (the default), a statement in a
transaction block that generates an error aborts the entire
transaction. The error rollback mode works by issuing an
implicit <command>SAVEPOINT</command> for you, just before each command
that is in a transaction block, and then rolling back to the
savepoint if the command fails.
</para>
</listitem>
</varlistentry>
<varlistentry id="app-psql-variables-on-error-stop">
<term><varname>ON_ERROR_STOP</varname></term>
<listitem>
<para>
By default, command processing continues after an error. When this
variable is set to <literal>on</literal>, processing will instead stop
immediately. In interactive mode,
<application>psql</application> will return to the command prompt;
otherwise, <application>psql</application> will exit, returning
error code 3 to distinguish this case from fatal error
conditions, which are reported using error code 1. In either case,
any currently running scripts (the top-level script, if any, and any
other scripts which it may have in invoked) will be terminated
immediately. If the top-level command string contained multiple SQL
commands, processing will stop with the current command.
</para>
</listitem>
</varlistentry>
<varlistentry id="app-psql-variables-pipeline-command-count">
<term><varname>PIPELINE_COMMAND_COUNT</varname></term>
<listitem>
<para>
The number of commands queued in an ongoing pipeline.
</para>
</listitem>
</varlistentry>
<varlistentry id="app-psql-variables-pipeline-result-count">
<term><varname>PIPELINE_RESULT_COUNT</varname></term>
<listitem>
<para>
The number of commands of an ongoing pipeline that were followed
by either a <command>\flushrequest</command> or a
<command>\syncpipeline</command>, forcing the server to send the
results. These results can be retrieved with
<command>\getresults</command>.
</para>
</listitem>
</varlistentry>
<varlistentry id="app-psql-variables-pipeline-sync-count">
<term><varname>PIPELINE_SYNC_COUNT</varname></term>
<listitem>
<para>
The number of sync messages queued in an ongoing pipeline.
</para>
</listitem>
</varlistentry>
<varlistentry id="app-psql-variables-port">
<term><varname>PORT</varname></term>
<listitem>
<para>
The database server port to which you are currently connected.
This is set every time you connect to a database (including
program start-up), but can be changed or unset.
</para>
</listitem>
</varlistentry>
<varlistentry id="app-psql-variables-prompt">
<term><varname>PROMPT1</varname></term>
<term><varname>PROMPT2</varname></term>