On Thu, Jan 24, 2019 at 10:09:30PM -0500, Bruce Momjian wrote:
> This seems like a bug to me.  Looking at the code, psql issues the
> prompts for STDIN, but when it sees \. alone on a line, it has no idea
> you are in a quoted CSV string, so it thinks the copy is done and sends
> the result to the server.  I can't see an easy way to fix this.  I guess
> we could document it.

In src/bin/psql/copy.c, handleCopyIn():

/*
 * This code erroneously assumes '\.' on a line alone
 * inside a quoted CSV string terminates the \copy.
 * 
http://www.postgresql.org/message-id/e1tdnvq-0001ju...@wrigleys.postgresql.org
 */
if (strcmp(buf, "\\.\n") == 0 ||
    strcmp(buf, "\\.\r\n") == 0)
{
    copydone = true;
    break;
}

This story pops up from time to time..
--
Michael

Attachment: signature.asc
Description: PGP signature

Reply via email to