Skip site navigation (1) Skip section navigation (2)

Re: [HACKERS] Trouble with COPY IN

From: Kris Jurka <books(at)ejurka(dot)com>
To: James William Pye <lists(at)jwp(dot)name>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers(at)postgresql(dot)org, Matthew Wakeling <matthew(at)flymine(dot)org>, Kevin Grittner <Kevin(dot)Grittner(at)wicourts(dot)gov>, Maciek Sakrejda <msakrejda(at)truviso(dot)com>, Samuel Gendler <sgendler(at)ideasculptor(dot)com>, pgsql-jdbc(at)postgresql(dot)org
Subject: Re: [HACKERS] Trouble with COPY IN
Date: 2010-07-25 15:01:48
Message-ID: alpine.BSO.2.00.1007251041530.16933@leary.csoft.net (view raw or flat)
Thread:
Lists: pgsql-hackerspgsql-jdbc

On Sat, 24 Jul 2010, James William Pye wrote:

> On Jul 23, 2010, at 7:11 AM, Tom Lane wrote:
>> I can't help thinking that the JDBC driver must be being overly cute
>> if this breaks it ...
>
> I was wondering the same thing when I first saw Kris' message. However, 
> iff I understand what JDBC is trying to achieve, I don't think I would 
> call it "overly".
>
> Is this a problem because JDBC is trying to detect failures as early as 
> possible during a COPY IN? Or, is it just JDBC's normal MO to always be 
> reading?

The JDBC driver reads server messages for multiple reasons.  One of them 
is indeed to do early failure detection.  Another is to pickup 
NoticeResponse messages to avoid a network buffer deadlock.  If someone 
puts a trigger on the table you're copying data into that does RAISE 
NOTICE 'received row X' for each row, to avoid a full network buffer 
deadlock, the client must regularly read from the backend.  So as we are 
reading along, supposing that we're still mid-copy, we get a command 
complete message.  So this is possible to work around driver side by 
peeking into the network stream and delaying processing of the end of copy 
until the driver agrees that the copy is done, but I still maintain that 
this is a server bug.  It is not OK for the server to assume that the 
client is done and move on, the client must tell the server what it wants 
done.

Kris Jurka

In response to

Responses

pgsql-hackers by date

Next:From: Jan UrbańskiDate: 2010-07-25 15:36:16
Subject: Re: review: psql: edit function, show function commands patch
Previous:From: PostgreSQL - Hans-Jürgen SchönigDate: 2010-07-25 14:41:03
Subject: Re: non-overlapping, consecutive partitions

pgsql-jdbc by date

Next:From: Scott LangleyDate: 2010-07-26 17:28:55
Subject: Re: JDBC / pgpass
Previous:From: James William PyeDate: 2010-07-25 02:03:20
Subject: Re: [HACKERS] Trouble with COPY IN

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group