embedded in field values will be doubled.
</para>
- <note>
- <para>
- Remember that what you write in an SQL command will first be interpreted
- as a string literal, and then as a composite. This doubles the number of
- backslashes you need (assuming escape string syntax is used).
- For example, to insert a <type>text</type> field
- containing a double quote and a backslash in a composite
- value, you'd need to write:
-<programlisting>
-INSERT ... VALUES ('("\"\\")');
-</programlisting>
- The string-literal processor removes one level of backslashes, so that
- what arrives at the composite-value parser looks like
- <literal>("\"\\")</literal>. In turn, the string
- fed to the <type>text</type> data type's input routine
- becomes <literal>"\</literal>. (If we were working
- with a data type whose input routine also treated backslashes specially,
- <type>bytea</type> for example, we might need as many as eight backslashes
- in the command to get one backslash into the stored composite field.)
- Dollar quoting (see <xref linkend="sql-syntax-dollar-quoting"/>) can be
- used to avoid the need to double backslashes.
- </para>
- </note>
-
<tip>
<para>
The <literal>ROW</literal> constructor syntax is usually easier to work with