Thread

  1. [PATCH 1/1] Doc: \123 and \x12 escapes in COPY are in database encoding.

    Heikki Linnakangas <heikki.linnakangas@iki.fi> — 2021-08-12T07:39:16Z

    The backslash sequences, including \123 and \x12 escapes, are interpreted
    after encoding conversion. The docs failed to mention that.
    
    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 14cd437da0..8f5e401284 100644
    --- a/doc/src/sgml/ref/copy.sgml
    +++ b/doc/src/sgml/ref/copy.sgml
    @@ -636,12 +636,12 @@ COPY <replaceable class="parameter">count</replaceable>
           <row>
            <entry><literal>\</literal><replaceable>digits</replaceable></entry>
            <entry>Backslash followed by one to three octal digits specifies
    -       the character with that numeric code</entry>
    +       the byte with that numeric code</entry>
           </row>
           <row>
            <entry><literal>\x</literal><replaceable>digits</replaceable></entry>
            <entry>Backslash <literal>x</literal> followed by one or two hex digits specifies
    -       the character with that numeric code</entry>
    +       the byte with that numeric code</entry>
           </row>
          </tbody>
         </tgroup>
    @@ -673,6 +673,12 @@ COPY <replaceable class="parameter">count</replaceable>
         or vice versa).
        </para>
     
    +   <para>
    +     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.
    +   </para>
    +
        <para>
         <command>COPY TO</command> will terminate each row with a Unix-style
         newline (<quote><literal>\n</literal></quote>).  Servers running on Microsoft Windows instead
    -- 
    2.30.2
    
    
    --------------FD0C67FABEA3F63BB149AE78--