interpolation (that is, <literal>:name</literal>,
<literal>:'name'</literal>, or <literal>:"name"</literal>) is not
replaced unless the named variable is currently set. In any case, you
can escape a colon with a backslash to protect it from substitution.
</para>
<para>
The <literal>:{?<replaceable>name</replaceable>}</literal> special syntax returns TRUE
or FALSE depending on whether the variable exists or not, and is thus
always substituted, unless the colon is backslash-escaped.
</para>
<para>
The colon syntax for variables is standard <acronym>SQL</acronym> for
embedded query languages, such as <application>ECPG</application>.
The colon syntaxes for array slices and type casts are
<productname>PostgreSQL</productname> extensions, which can sometimes
conflict with the standard usage. The colon-quote syntax for escaping a
variable's value as an SQL literal or identifier is a
<application>psql</application> extension.
</para>
</refsect3>
<refsect3 id="app-psql-prompting" xreflabel="Prompting">
<title>Prompting</title>
<para>
The prompts <application>psql</application> issues can be customized
to your preference. The three variables <varname>PROMPT1</varname>,
<varname>PROMPT2</varname>, and <varname>PROMPT3</varname> contain strings
and special escape sequences that describe the appearance of the
prompt. Prompt 1 is the normal prompt that is issued when
<application>psql</application> requests a new command. Prompt 2 is
issued when more input is expected during command entry, for example
because the command was not terminated with a semicolon or a quote
was not closed.
Prompt 3 is issued when you are running an <acronym>SQL</acronym>
<command>COPY FROM STDIN</command> command and you need to type in
a row value on the terminal.
</para>
<para>
The value of the selected prompt variable is printed literally,
except where a percent sign (<literal>%</literal>) is encountered.
Depending on the next character, certain other text is substituted
instead. Defined substitutions are:
<variablelist>
<varlistentry id="app-psql-prompting-m-uc">
<term><literal>%M</literal></term>
<listitem>
<para>
The full host name (with domain name) of the database server,
or <literal>[local]</literal> if the connection is over a Unix
domain socket, or
<literal>[local:<replaceable>/dir/name</replaceable>]</literal>,
if the Unix domain socket is not at the compiled in default
location.
</para>
</listitem>
</varlistentry>
<varlistentry id="app-psql-prompting-m-lc">
<term><literal>%m</literal></term>
<listitem>
<para>
The host name of the database server, truncated at the
first dot, or <literal>[local]</literal> if the connection is
over a Unix domain socket.
</para>
</listitem>
</varlistentry>
<varlistentry id="app-psql-prompting-gt">
<term><literal>%></literal></term>
<listitem><para>The port number at which the database server is listening.</para></listitem>
</varlistentry>
<varlistentry id="app-psql-prompting-n">
<term><literal>%n</literal></term>
<listitem>
<para>
The database session user name. (The expansion of this
value might change during a database session as the result
of the command <command>SET SESSION
AUTHORIZATION</command>.)
</para>
</listitem>
</varlistentry>
<varlistentry id="app-psql-prompting-s">
<term><literal>%s</literal></term>
<listitem><para>The name of the service.</para></listitem>
</varlistentry>
<varlistentry id="app-psql-prompting-slash">
<term><literal>%/</literal></term>
<listitem><para>The