pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Kris Jurka <books@ejurka.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: pgsql-hackers@postgresql.org, Matthew Wakeling <matthew@flymine.org>
Cc: Kevin Grittner <Kevin.Grittner@wicourts.gov>
Cc: Maciek Sakrejda <msakrejda@truviso.com>
Cc: Samuel Gendler <sgendler@ideasculptor.com>
Cc: pgsql-jdbc@postgresql.org
Subject: Re: [HACKERS] Trouble with COPY IN
Date: Fri, 23 Jul 2010 11:35:53 -0400 (EDT)
Message-ID: <alpine.BSO.2.00.1007231130130.23628@leary.csoft.net> (raw)
In-Reply-To: <9653.1279894296@sss.pgh.pa.us>
References: <alpine.DEB.2.00.1007161753160.8895@aragorn.flymine.org>
	<AANLkTim0dNU58e_Zg3OGTlylkYVAA9rtyhnb-xfzyLTl@mail.gmail.com>
	<alpine.DEB.2.00.1007191455550.8895@aragorn.flymine.org>
	<alpine.DEB.2.00.1007191514510.8895@aragorn.flymine.org>
	<AANLkTimCYa3fvWu2-NwcUc_7GibTpFB1RjNC09IVk8IS@mail.gmail.com>
	<alpine.DEB.2.00.1007201114080.8895@aragorn.flymine.org>
	<alpine.DEB.2.00.1007201128560.8895@aragorn.flymine.org>
	<AANLkTinVNt56ZuxRf0KNgBR-kJPN1NkTgDkHY2DXIPQr@mail.gmail.com>
	<alpine.DEB.2.00.1007201229110.8895@aragorn.flymine.org>
	<alpine.DEB.2.00.1007201422270.8895@aragorn.flymine.org>
	<4C4562C50200002500033951@gw.wicourts.gov>
	<alpine.DEB.2.00.1007201452360.8895@aragorn.flymine.org>
	<alpine.DEB.2.00.1007201507500.8895@aragorn.flymine.org>
	<alpine.BSO.2.00.1007201455220.5084@leary.csoft.net>
	<alpine.BSO.2.00.1007221723230.16703@leary.csoft.net>
	<9143.1279892435@sss.pgh.pa.us>
	<4C499E26.4060307@ejurka.com>
	<9653.1279894296@sss.pgh.pa.us>



On Fri, 23 Jul 2010, Tom Lane wrote:

> Kris Jurka <books@ejurka.com> writes:
>> On 7/23/2010 6:40 AM, Tom Lane wrote:
>>> I believe this is a misunderstanding of the protocol spec.  The spec is
>>> (intended to say that) we'll continue to accept data after reporting an
>>> error, not that we will silently swallow an incorrect data stream and
>>> not complain about it.  Which is what this patch will do.
>
>> All this does is make binary mode match text mode.
>
> The fact that text mode eats data after \. is a backwards-compatibility
> kluge to match the behavior of pre-7.4 COPY.  It could very legitimately
> be argued to be a bug in itself.  I don't think that we should make
> binary mode match it.  The main concrete reason why not is that binary
> mode has almost no redundancy.  It would be really easy for the code
> change you suggest to result in data being silently discarded with no
> hint of what went wrong.

Binary copy mode already does this (eat data silently after -1 field 
count).  The patch I sent just made it follow the fe/be protocol while it 
does so.

jurka=# create table copytest (a int);
CREATE TABLE
jurka=# insert into copytest values (1);
INSERT 0 1
jurka=# \copy copytest to copydata with binary
jurka=# \! echo garbage >> copydata
jurka=# \copy copytest from copydata with binary
jurka=# select * from copytest;
  a
---
  1
  1
(2 rows)


> After some reflection, I think the real issue here is that the JDBC
> driver is depending on a behavior not stated in the protocol, which
> is the relative timing of FE-to-BE and BE-to-FE messages.  Once you've
> sent the EOF marker, the only correct follow-on for a spec-compliant
> frontend is a CopyEnd message.  So the backend is just sending its
> response a bit sooner.  There's nothing in the protocol spec forbidding
> that.

What about CopyFail?  The protocol docs say nothing about the message 
contents only about the messages themselves.

Kris Jurka



view thread (48+ messages)  latest in thread

Message-ID: <alpine.BSO.2.00.1007231130130.23628@leary.csoft.net>
Permalink:  ../alpine.BSO.2.00.1007231130130.23628@leary.csoft.net/
Also on:    postgresql.org/message-id/alpine.BSO.2.00.1007231130130.23628@leary.csoft.net

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-jdbc@postgresql.org
  Cc: books@ejurka.com, tgl@sss.pgh.pa.us, matthew@flymine.org, Kevin.Grittner@wicourts.gov, msakrejda@truviso.com, sgendler@ideasculptor.com
  Subject: Re: [HACKERS] Trouble with COPY IN
  In-Reply-To: <alpine.BSO.2.00.1007231130130.23628@leary.csoft.net>
  References: <alpine.DEB.2.00.1007161753160.8895@aragorn.flymine.org> <alpine.DEB.2.00.1007191455550.8895@aragorn.flymine.org> <alpine.DEB.2.00.1007191514510.8895@aragorn.flymine.org> <AANLkTimCYa3fvWu2-NwcUc_7GibTpFB1RjNC09IVk8IS@mail.gmail.com> <alpine.DEB.2.00.1007201114080.8895@aragorn.flymine.org> <alpine.DEB.2.00.1007201128560.8895@aragorn.flymine.org> <AANLkTinVNt56ZuxRf0KNgBR-kJPN1NkTgDkHY2DXIPQr@mail.gmail.com> <alpine.DEB.2.00.1007201229110.8895@aragorn.flymine.org> <alpine.DEB.2.00.1007201422270.8895@aragorn.flymine.org> <4C4562C50200002500033951@gw.wicourts.gov> <alpine.DEB.2.00.1007201452360.8895@aragorn.flymine.org> <alpine.DEB.2.00.1007201507500.8895@aragorn.flymine.org> <alpine.BSO.2.00.1007201455220.5084@leary.csoft.net> <alpine.BSO.2.00.1007221723230.16703@leary.csoft.net> <9143.1279892435@sss.pgh.pa.us> <4C499E26.4060307@ejurka.com> <9653.1279894296@sss.pgh.pa.us> <alpine.BSO.2.00.1007231130130.23628@leary.csoft.net>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox