Skip to content

Commit c9e75c2

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 7f0873f commit c9e75c2

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
@@ -628,12 +628,12 @@ COPY <replaceable class="parameter">count</replaceable>
628628
<row>
629629
<entry><literal>\</literal><replaceable>digits</replaceable></entry>
630630
<entry>Backslash followed by one to three octal digits specifies
631-
the character with that numeric code</entry>
631+
the byte with that numeric code</entry>
632632
</row>
633633
<row>
634634
<entry><literal>\x</literal><replaceable>digits</replaceable></entry>
635635
<entry>Backslash <literal>x</literal> followed by one or two hex digits specifies
636-
the character with that numeric code</entry>
636+
the byte with that numeric code</entry>
637637
</row>
638638
</tbody>
639639
</tgroup>
@@ -665,6 +665,12 @@ COPY <replaceable class="parameter">count</replaceable>
665665
or vice versa).
666666
</para>
667667

668+
<para>
669+
All backslash sequences are interpreted after encoding conversion.
670+
The bytes specified with the octal and hex-digit backslash sequences must
671+
form valid characters in the database encoding.
672+
</para>
673+
668674
<para>
669675
<command>COPY TO</command> will terminate each row with a Unix-style
670676
newline (<quote><literal>\n</literal></quote>). Servers running on Microsoft Windows instead

0 commit comments

Comments
 (0)