Re: Trouble with COPY IN

Kris Jurka <books@ejurka.com>

From: Kris Jurka <books@ejurka.com>
To: Matthew Wakeling <matthew@flymine.org>
Cc: Kevin Grittner <Kevin.Grittner@wicourts.gov>, Maciek Sakrejda <msakrejda@truviso.com>, Samuel Gendler <sgendler@ideasculptor.com>, pgsql-jdbc@postgresql.org
Date: 2010-07-20T18:58:09Z
Lists: pgsql-hackers

On Tue, 20 Jul 2010, Matthew Wakeling wrote:

> Okay, have investigated a little further. It seems that the server may be 
> responding to the client a little too quickly with the "all done" message. 
> Here is a sequence of events in core.v3.QueryExecutorImpl:
>
> We call startCopy(). It calls processCopyResults().
> In processCopyResults, we receive character G, and we lock.
>
> We call writeToCopy(). It calls processCopyResults().
> We receive character C.
> We receive character Z, and unlock.
>
> We call endCopy(), which tries to unlock and fails.
>
>
> So, should the unlocking happen elsewhere, or should endCopy not require a 
> lock?

To me it seems like a protocol violation to receive CommandComplete(C) and 
ReadyForQuery(Z) before we've issued CopyDone(c) and this should be fixed 
server side.

Kris Jurka