e.g.,
<literal>'Dianne''s horse'</literal>.
Note that this is <emphasis>not</emphasis> the same as a double-quote
character (<literal>"</literal>). <!-- font-lock sanity: " -->
</para>
<para>
Two string constants that are only separated by whitespace
<emphasis>with at least one newline</emphasis> are concatenated
and effectively treated as if the string had been written as one
constant. For example:
<programlisting>
SELECT 'foo'
'bar';
</programlisting>
is equivalent to:
<programlisting>
SELECT 'foobar';
</programlisting>
but:
<programlisting>
SELECT 'foo' 'bar';
</programlisting>
is not valid syntax. (This slightly bizarre behavior is specified
by <acronym>SQL</acronym>; <productname>PostgreSQL</productname> is
following the standard.)
</para>
</sect3>
<sect3 id="sql-syntax-strings-escape">
<title>String Constants with C-Style Escapes</title>
<indexterm zone="sql-syntax-strings-escape">
<primary>escape string syntax</primary>
</indexterm>
<indexterm zone="sql-syntax-strings-escape">
<primary>backslash escapes</primary>
</indexterm>
<para>
<productname>PostgreSQL</productname> also accepts <quote>escape</quote>
string constants, which are an extension to the SQL standard.
An escape string constant is specified by writing the letter
<literal>E</literal> (upper or lower case) just before the opening single
quote, e.g., <literal>E'foo'</literal>. (When continuing an escape string
constant across lines, write <literal>E</literal> only before the first opening
quote.)
Within an escape string, a backslash character (<literal>\</literal>) begins a
C-like <firstterm>backslash escape</firstterm> sequence, in which the combination
of backslash and following character(s) represent a special byte
value, as shown in <xref linkend="sql-backslash-table"/>.
</para>
<table id="sql-backslash-table">
<title>Backslash Escape Sequences</title>
<tgroup cols="2">
<thead>
<row>
<entry>Backslash Escape Sequence</entry>
<entry>Interpretation</entry>
</row>
</thead>
<tbody>
<row>
<entry><literal>\b</literal></entry>
<entry>backspace</entry>
</row>
<row>
<entry><literal>\f</literal></entry>
<entry>form feed</entry>
</row>
<row>
<entry><literal>\n</literal></entry>
<entry>newline</entry>
</row>
<row>
<entry><literal>\r</literal></entry>
<entry>carriage return</entry>
</row>
<row>
<entry><literal>\t</literal></entry>
<entry>tab</entry>
</row>
<row>
<entry>
<literal>\<replaceable>o</replaceable></literal>,
<literal>\<replaceable>oo</replaceable></literal>,
<literal>\<replaceable>ooo</replaceable></literal>
(<replaceable>o</replaceable> = 0–7)
</entry>
<entry>octal byte value</entry>
</row>
<row>
<entry>
<literal>\x<replaceable>h</replaceable></literal>,
<literal>\x<replaceable>hh</replaceable></literal>
(<replaceable>h</replaceable> = 0–9, A–F)
</entry>
<entry>hexadecimal byte value</entry>
</row>
<row>
<entry>
<literal>\u<replaceable>xxxx</replaceable></literal>,
<literal>\U<replaceable>xxxxxxxx</replaceable></literal>
(<replaceable>x</replaceable> = 0–9, A–F)
</entry>
<entry>16 or 32-bit hexadecimal Unicode character value</entry>
</row>
</tbody>
</tgroup>
</table>
<para>
Any other
character following a backslash is taken literally. Thus, to
include a backslash character, write two backslashes (<literal>\\</literal>).
Also, a single quote can be included in an escape string by writing