Re: [HACKERS] COPY problems with psql / libpq - Mailing list pgsql-hackers

From Tom Lane
Subject Re: [HACKERS] COPY problems with psql / libpq
Date
Msg-id 21145.948384151@sss.pgh.pa.us
Whole thread Raw
In response to COPY problems with psql / libpq  ("Oliver Elphick" <olly@lfix.co.uk>)
Responses Re: [HACKERS] COPY problems with psql / libpq
Re: [HACKERS] COPY problems with psql / libpq
Re: [HACKERS] COPY problems with psql / libpq
List pgsql-hackers
"Oliver Elphick" <olly@lfix.co.uk> writes:
> I found that if I broke the first 1000 records into 2 equal parts, all
> of them were added correctly without error; so I conclude that data
> is being buffered and lost somewhere in psql or libpq, and the problem is
> dependent on the amount of data being copied.

I have the following note in my (much too long) to-do list:

: psql.c doesn't appear to cope correctly with quoted newlines in COPY data;
: if one falls just after a buffer boundary, trouble!
: Does fe-exec.c work either??

(This note is some months old, and may or may not still apply since
Peter's rework of psql.)  It could be that your dataset is hitting this
problem or a similar one.  A buffer-boundary problem would explain why
the error seems to be so dataset-specific.

> copy address from stdin;
> -- 1000 records written
> select count(*) from address;
> PQexec: you gotta get out of a COPY state yourself.

It sure sounds like psql is failing to recognize the trailing \.
of the COPY data.
        regards, tom lane


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: [HACKERS] A notice for too long names
Next
From: Robert Davis
Date:
Subject: off topic