<term><varname>SHELL_ERROR</varname></term>
<listitem>
<para>
<literal>true</literal> if the last shell command
failed, <literal>false</literal> if it succeeded.
This applies to shell commands invoked via the <literal>\!</literal>,
<literal>\g</literal>, <literal>\o</literal>, <literal>\w</literal>,
and <literal>\copy</literal> meta-commands, as well as backquote
(<literal>`</literal>) expansion. Note that
for <literal>\o</literal>, this variable is updated when the output
pipe is closed by the next <literal>\o</literal> command.
See also <varname>SHELL_EXIT_CODE</varname>.
</para>
</listitem>
</varlistentry>
<varlistentry id="app-psql-variables-shell-exit-code">
<term><varname>SHELL_EXIT_CODE</varname></term>
<listitem>
<para>
The exit status returned by the last shell command.
0–127 represent program exit codes, 128–255
indicate termination by a signal, and -1 indicates failure
to launch a program or to collect its exit status.
This applies to shell commands invoked via the <literal>\!</literal>,
<literal>\g</literal>, <literal>\o</literal>, <literal>\w</literal>,
and <literal>\copy</literal> meta-commands, as well as backquote
(<literal>`</literal>) expansion. Note that
for <literal>\o</literal>, this variable is updated when the output
pipe is closed by the next <literal>\o</literal> command.
See also <varname>SHELL_ERROR</varname>.
</para>
</listitem>
</varlistentry>
<varlistentry id="app-psql-variables-show-all-results">
<term><varname>SHOW_ALL_RESULTS</varname></term>
<listitem>
<para>
When this variable is set to <literal>off</literal>, only the last
result of a combined query (<literal>\;</literal>) is shown instead of
all of them. The default is <literal>on</literal>. The off behavior
is for compatibility with older versions of
<application>psql</application>.
</para>
</listitem>
</varlistentry>
<varlistentry id="app-psql-variables-show-context">
<term><varname>SHOW_CONTEXT</varname></term>
<listitem>
<para>
This variable can be set to the
values <literal>never</literal>, <literal>errors</literal>, or <literal>always</literal>
to control whether <literal>CONTEXT</literal> fields are displayed in
messages from the server. The default is <literal>errors</literal> (meaning
that context will be shown in error messages, but not in notice or
warning messages). This setting has no effect
when <varname>VERBOSITY</varname> is set to <literal>terse</literal>
or <literal>sqlstate</literal>.
(See also <command>\errverbose</command>, for use when you want a verbose
version of the error you just got.)
</para>
</listitem>
</varlistentry>
<varlistentry id="app-psql-variables-singleline">
<term><varname>SINGLELINE</varname></term>
<listitem>
<para>
Setting this variable to <literal>on</literal> is equivalent to the command
line option <option>-S</option>.
</para>
</listitem>
</varlistentry>
<varlistentry id="app-psql-variables-singlestep">
<term><varname>SINGLESTEP</varname></term>
<listitem>
<para>
Setting this variable to <literal>on</literal> is equivalent to the command
line option <option>-s</option>.
</para>
</listitem>
</varlistentry>
<varlistentry id="app-psql-variables-sqlstate">
<term><varname>SQLSTATE</varname></term>
<listitem>
<para>
The error code (see <xref linkend="errcodes-appendix"/>) associated
with the last SQL query's failure, or <literal>00000</literal>