Received: from maia.hub.org (maia-5.hub.org [200.46.204.29]) by mail.postgresql.org (Postfix) with ESMTP id B563D632889 for ; Fri, 23 Jul 2010 12:36:03 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.29]) (amavisd-maia, port 10024) with ESMTP id 68536-01; Fri, 23 Jul 2010 15:35:55 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from mail63.csoft.net (mail63.csoft.net [205.205.214.4]) by mail.postgresql.org (Postfix) with ESMTP id 89116632D98; Fri, 23 Jul 2010 12:35:55 -0300 (ADT) Received: from mail63.csoft.net (localhost [127.0.0.1]) by mail63.csoft.net (Postfix) with ESMTP id 3CDC528415; Fri, 23 Jul 2010 11:35:54 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=csoft.net; h=date:from:to :cc:subject:in-reply-to:message-id:references:mime-version :content-type; s=sel1; bh=KrQmoEFnDz+8RIlBjamqGEQQ6mA=; b=afmRXK T1z5wo+xxdhB1BDoHWXcyColRxTTXlMIrwjIvkbIlwzS3tJ+3C2BCGXTr0+WUulI vfvyimgjDIfAsp2vtwgfRMbsZB664sL2Xba3Vmx6Xu5bbYwkm0FBtGIKIyEZyhnZ 92GfRCCuukRjCotLzXrV4srfkbiJduWLhAQC0= Received: from leary.csoft.net (leary.csoft.net [205.205.214.5]) by mail63.csoft.net (Postfix) with ESMTP id 306632840F; Fri, 23 Jul 2010 11:35:54 -0400 (EDT) Received: by leary.csoft.net (Postfix, from userid 1112) id 2C62EA250; Fri, 23 Jul 2010 11:35:54 -0400 (EDT) Date: Fri, 23 Jul 2010 11:35:53 -0400 (EDT) From: Kris Jurka X-X-Sender: books@leary.csoft.net To: Tom Lane cc: pgsql-hackers@postgresql.org, Matthew Wakeling , Kevin Grittner , Maciek Sakrejda , Samuel Gendler , pgsql-jdbc@postgresql.org Subject: Re: [HACKERS] Trouble with COPY IN In-Reply-To: <9653.1279894296@sss.pgh.pa.us> Message-ID: References: <4C4562C50200002500033951@gw.wicourts.gov> <9143.1279892435@sss.pgh.pa.us> <4C499E26.4060307@ejurka.com> <9653.1279894296@sss.pgh.pa.us> User-Agent: Alpine 2.00 (BSO 1167 2008-08-23) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.91 tagged_above=-10 required=5 tests=BAYES_00=-1.9, T_RP_MATCHES_RCVD=-0.01 X-Spam-Level: X-Archive-Number: 201007/95 X-Sequence-Number: 20760 On Fri, 23 Jul 2010, Tom Lane wrote: > Kris Jurka 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