doc: \123 and \x12 escapes in COPY are in database encoding.
authorHeikki Linnakangas
Tue, 17 Aug 2021 07:00:06 +0000 (10:00 +0300)
committerHeikki Linnakangas
Tue, 17 Aug 2021 07:01:24 +0000 (10:01 +0300)
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

index 14cd437da0acfb797d3289c5b83581eaa38dd87f..4624c8f4c98611e59beb8849ed7850e16b9cfe0f 100644 (file)
@@ -636,12 +636,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
       
      
     
@@ -673,6 +673,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