<literal>false</literal>, <literal>1</literal>,
<literal>0</literal>, <literal>on</literal>, <literal>off</literal>,
<literal>yes</literal>, <literal>no</literal>. For example,
<literal>t</literal>, <literal>T</literal>, and <literal>tR</literal>
will all be considered to be <literal>true</literal>.
</para>
<para>
Expressions that do not properly evaluate to true or false will
generate a warning and be treated as false.
</para>
<para>
Lines being skipped are parsed normally to identify queries and
backslash commands, but queries are not sent to the server, and
backslash commands other than conditionals
(<command>\if</command>, <command>\elif</command>,
<command>\else</command>, <command>\endif</command>) are
ignored. Conditional commands are checked only for valid nesting.
Variable references in skipped lines are not expanded, and backquote
expansion is not performed either.
</para>
<para>
All the backslash commands of a given conditional block must appear in
the same source file. If EOF is reached on the main input file or an
<command>\include</command>-ed file before all local
<command>\if</command>-blocks have been closed,
then <application>psql</application> will raise an error.
</para>
<para>
Here is an example:
</para>
<programlisting>
-- check for the existence of two separate records in the database and store
-- the results in separate psql variables
SELECT
EXISTS(SELECT 1 FROM customer WHERE customer_id = 123) as is_customer,
EXISTS(SELECT 1 FROM employee WHERE employee_id = 456) as is_employee
\gset
\if :is_customer
SELECT * FROM customer WHERE customer_id = 123;
\elif :is_employee
\echo 'is not a customer but is an employee'
SELECT * FROM employee WHERE employee_id = 456;
\else
\if yes
\echo 'not a customer or employee'
\else
\echo 'this will never print'
\endif
\endif
</programlisting>
</listitem>
</varlistentry>
<varlistentry id="app-psql-meta-command-include-relative">
<term><literal>\ir</literal> or <literal>\include_relative</literal> <replaceable class="parameter">filename</replaceable></term>
<listitem>
<para>
The <literal>\ir</literal> command is similar to <literal>\i</literal>, but resolves
relative file names differently. When executing in interactive mode,
the two commands behave identically. However, when invoked from a
script, <literal>\ir</literal> interprets file names relative to the
directory in which the script is located, rather than the current
working directory.
</para>
</listitem>
</varlistentry>
<varlistentry id="app-psql-meta-command-list">
<term><literal>\l[x+]</literal> or <literal>\list[x+] [ <link linkend="app-psql-patterns"><replaceable class="parameter">pattern</replaceable></link> ]</literal></term>
<listitem>
<para>
List the databases in the server and show their names, owners,
character set encodings, and access privileges.
If <replaceable class="parameter">pattern</replaceable> is specified,
only databases whose names match the pattern are listed.
If <literal>x</literal> is appended to the command name, the results
are displayed in expanded mode.
If <literal>+</literal> is appended to the command name, database
sizes, default tablespaces, and descriptions are also displayed.
(Size information is only available for databases that the current
user can connect to.)
</para>
</listitem>
</varlistentry>
<varlistentry id="app-psql-meta-command-lo-export">
<term><literal>\lo_export <replaceable class="parameter">loid</replaceable> <replaceable class="parameter">filename</replaceable></literal></term>