Doc: remove obsolete, confused <note> about rowtype I/O syntax.

This <note> was originally written to describe the double levels
of de-backslashing encountered when a backslash-aware string
literal is used to hold the text representation of a composite
value.  It still made sense when we switched to mostly using E'...'
syntax for that type of literal.  However, commit f77de4b0c mangled
it completely by changing the example literal to be SQL-standard.
The extra pass of de-backslashing described in the text doesn't
actually occur with the example as written, unless you happen to
be using standard_conforming_strings = off.

We could restore this <note> to self-consistency by reverting the
change from f77de4b0c, but on the whole I judge that its time has
passed.  standard_conforming_strings = off is nearly obsolete,
and may soon be fully so.  But without that, the behavior isn't
so complicated as to justify a discursive note.  I observe that
the nearby section about array I/O syntax has no equivalent text,
although that syntax is equally subject to this issue.

Author: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/2998401.1767038920@sss.pgh.pa.us
Discussion: https://postgr.es/m/3279216.1767072538@sss.pgh.pa.us
master
Tom Lane 1 week ago
parent 915711c8a4
commit d6542f8dfc
  1. 24
      doc/src/sgml/rowtypes.sgml

@ -502,30 +502,6 @@ SELECT c.somefunc FROM inventory_item c;
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

Loading…
Cancel
Save