From 7d6d1555926ae6c5b24016a3399b5cdf73fe712f Mon Sep 17 00:00:00 2001 From: Heikki Linnakangas Date: Tue, 17 Aug 2021 10:00:06 +0300 Subject: [PATCH] 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 --- doc/src/sgml/ref/copy.sgml | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/doc/src/sgml/ref/copy.sgml b/doc/src/sgml/ref/copy.sgml index 085a380d0f1..0c283d3fffb 100644 --- a/doc/src/sgml/ref/copy.sgml +++ b/doc/src/sgml/ref/copy.sgml @@ -610,12 +610,12 @@ COPY count \digits Backslash followed by one to three octal digits specifies - the character with that numeric code + the byte with that numeric code \xdigits Backslash x followed by one or two hex digits specifies - the character with that numeric code + the byte with that numeric code @@ -647,6 +647,12 @@ COPY count or vice versa). + + All backslash sequences are interpreted after encoding conversion. + The bytes specified with the octal and hex-digit backslash sequences must + form valid characters in the database encoding. + + COPY TO will terminate each row with a Unix-style newline (\n). Servers running on Microsoft Windows instead -- 2.39.5