Skip to content

Commit e9a79c2

Browse files
committed
doc: \123 and \x12 escapes in COPY are in database encoding.
The backslash sequences, including \123 and \x12 escapes, are interpreted after encoding conversion. The docs failed to mention that. Backpatch to all supported versions. Reported-by: Andreas Grob Discussion: https://www.postgresql.org/message-id/17142-9181542ca1df75ab%40postgresql.org
1 parent 6f8127b commit e9a79c2

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

doc/src/sgml/ref/copy.sgml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -636,12 +636,12 @@ COPY <replaceable class="parameter">count</replaceable>
636636
<row>
637637
<entry><literal>\</literal><replaceable>digits</replaceable></entry>
638638
<entry>Backslash followed by one to three octal digits specifies
639-
the character with that numeric code</entry>
639+
the byte with that numeric code</entry>
640640
</row>
641641
<row>
642642
<entry><literal>\x</literal><replaceable>digits</replaceable></entry>
643643
<entry>Backslash <literal>x</literal> followed by one or two hex digits specifies
644-
the character with that numeric code</entry>
644+
the byte with that numeric code</entry>
645645
</row>
646646
</tbody>
647647
</tgroup>
@@ -673,6 +673,12 @@ COPY <replaceable class="parameter">count</replaceable>
673673
or vice versa).
674674
</para>
675675

676+
<para>
677+
All backslash sequences are interpreted after encoding conversion.
678+
The bytes specified with the octal and hex-digit backslash sequences must
679+
form valid characters in the database encoding.
680+
</para>
681+
676682
<para>
677683
<command>COPY TO</command> will terminate each row with a Unix-style
678684
newline (<quote><literal>\n</literal></quote>). Servers running on Microsoft Windows instead

0 commit comments

Comments
 (0)