]> git.ipfire.org Git - thirdparty/postgresql.git/commitdiff
doc: \copy can get data values \. and end-of-input confused
authorBruce Momjian <bruce@momjian.us>
Fri, 3 Nov 2023 17:57:58 +0000 (13:57 -0400)
committerBruce Momjian <bruce@momjian.us>
Fri, 3 Nov 2023 17:57:58 +0000 (13:57 -0400)
Reported-by: Svante Richter
Discussion: https://postgr.es/m/fcd57e4-8f23-4c3e-a5db-2571d09208e2@beta.fastmail.com

Backpatch-through: 11

doc/src/sgml/ref/psql-ref.sgml
src/bin/psql/copy.c

index 1802330b703d72ab66dc63c2b223ac7d167e46d2..2673684ace38fd7644f34724a03c2e3b5b80f19c 100644 (file)
@@ -1075,6 +1075,10 @@ testdb=&gt;
         destination, because all data must pass through the client/server
         connection.  For large amounts of data the <acronym>SQL</acronym>
         command might be preferable.
+        Also, because of this pass-through method, <literal>\copy
+        ... from</literal> in <acronym>CSV</acronym> mode will erroneously
+        treat a <literal>\.</literal> data value alone on a line as an
+        end-of-input marker.
         </para>
         </tip>
 
index f59db8d7bd080d99d5e84ed8d80b4179615d4123..929347253834a58e37eac841cb160fab12859964 100644 (file)
@@ -629,6 +629,7 @@ handleCopyIn(PGconn *conn, FILE *copystream, bool isbinary, PGresult **res)
                                         * This code erroneously assumes '\.' on a line alone
                                         * inside a quoted CSV string terminates the \copy.
                                         * https://www.postgresql.org/message-id/E1TdNVQ-0001ju-GO@wrigleys.postgresql.org
+                                        * https://www.postgresql.org/message-id/bfcd57e4-8f23-4c3e-a5db-2571d09208e2@beta.fastmail.com
                                         */
                                        if (strcmp(buf, "\\.\n") == 0 ||
                                                strcmp(buf, "\\.\r\n") == 0)