Re: \copy produces CSV output that cannot be read by \copy

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
Cc: Nicolas Barbier <nicolas(dot)barbier(at)gmail(dot)com>, PostgreSQL Bugs <pgsql-bugs(at)postgresql(dot)org>
Subject: Re: \copy produces CSV output that cannot be read by \copy
Date: 2017-08-05 16:52:28
Message-ID: 1473.1501951948@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Michael Paquier <michael(dot)paquier(at)gmail(dot)com> writes:
> The format produced by COPY OUT looks fine to me, and can be reloaded
> with a plain COPY (not \copy). And you may be interested in this bit
> from src/bin/psql/copy.c:
> /*
> * This code erroneously assumes '\.' on a line alone
> * inside a quoted CSV string terminates the \copy.
> *
> http://www.postgresql.org/message-id/E1TdNVQ-0001ju-GO@wrigleys.postgresql.org
> */

I wonder if it would improve matters to check for "\." only when
copystream == pset.cur_cmd_source, that is, only when the copy data
is inlined into the SQL stream. That would create an inconsistency
between inline and out-of-line data, but it might be a reasonable
thing to do anyway.

regards, tom lane

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Andres Freund 2017-08-05 22:06:06 Re: [BUG] pg9.4.10 Logical decoding did not get the correct oldtuplelen
Previous Message Michael Paquier 2017-08-05 16:39:19 Re: \copy produces CSV output that cannot be read by \copy