Skip to content

Commit 930bc76

Browse files
committed
doc: \copy can get data values \. and end-of-input confused
Reported-by: Svante Richter Discussion: https://postgr.es/m/fcd57e4-8f23-4c3e-a5db-2571d09208e2@beta.fastmail.com Backpatch-through: 11
1 parent 54af107 commit 930bc76

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

doc/src/sgml/ref/psql-ref.sgml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1060,6 +1060,10 @@ testdb=>
10601060
destination, because all data must pass through the client/server
10611061
connection. For large amounts of data the <acronym>SQL</acronym>
10621062
command might be preferable.
1063+
Also, because of this pass-through method, <literal>\copy
1064+
... from</literal> in <acronym>CSV</acronym> mode will erroneously
1065+
treat a <literal>\.</literal> data value alone on a line as an
1066+
end-of-input marker.
10631067
</para>
10641068
</tip>
10651069

src/bin/psql/copy.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -633,6 +633,7 @@ handleCopyIn(PGconn *conn, FILE *copystream, bool isbinary, PGresult **res)
633633
* This code erroneously assumes '\.' on a line alone
634634
* inside a quoted CSV string terminates the \copy.
635635
* http://www.postgresql.org/message-id/E1TdNVQ-0001ju-GO@wrigleys.postgresql.org
636+
* https://www.postgresql.org/message-id/bfcd57e4-8f23-4c3e-a5db-2571d09208e2@beta.fastmail.com
636637
*/
637638
if (strcmp(buf, "\\.\n") == 0 ||
638639
strcmp(buf, "\\.\r\n") == 0)

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy