X-Original-To: pgsql-interfaces-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 0BD2E529B6 for ; Tue, 9 Aug 2005 23:24:46 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 58361-08 for ; Wed, 10 Aug 2005 02:24:38 +0000 (GMT) Received: from smtp-vbr6.xs4all.nl (smtp-vbr6.xs4all.nl [194.109.24.26]) by svr1.postgresql.org (Postfix) with ESMTP id 49AD8529A8 for ; Tue, 9 Aug 2005 23:24:36 -0300 (ADT) Received: from webmail.xs4all.nl (webmail12.xs4all.nl [194.109.22.172]) by smtp-vbr6.xs4all.nl (8.13.3/8.13.3) with ESMTP id j7A2OdKv072393; Wed, 10 Aug 2005 04:24:39 +0200 (CEST) (envelope-from jtv@xs4all.nl) Received: from 202.47.227.25 by webmail.xs4all.nl with HTTP; Wed, 10 Aug 2005 04:24:39 +0200 (CEST) Message-ID: <6201.202.47.227.25.1123640679.squirrel@202.47.227.25> In-Reply-To: <16904.1123604812@sss.pgh.pa.us> References: <4395.210.86.147.191.1123600604.squirrel@210.86.147.191> <16904.1123604812@sss.pgh.pa.us> Date: Wed, 10 Aug 2005 04:24:39 +0200 (CEST) Subject: Re: Getting results after networking error From: jtv@xs4all.nl To: "Tom Lane" Cc: pgsql-interfaces@postgresql.org User-Agent: SquirrelMail/1.4.3a X-Mailer: SquirrelMail/1.4.3a MIME-Version: 1.0 Content-Type: text/plain;charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Virus-Scanned: by XS4ALL Virus Scanner X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.228 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO, NO_REAL_NAME X-Spam-Level: X-Archive-Number: 200508/8 X-Sequence-Number: 5679 Tom Lane wrote: >> Now let's say that I issue my next query and the network connection >> recovers in the process. I happily start retrieving results again, but >> are they only results for the new query, or do I go through the >> remaining >> results of the last query first? > > I don't think there is a unique answer to that, without a whole lot of > assumptions about the nature of the failure and the behavior of the > network transport layer. Did the backend see any send() failures? > Did the transport layer permanently lose any data already given to it, > or just delay transmission? Well, I'm sort of assuming that if some data was actually lost, libpq would call that a synchronization error and give up on the connection. So I'm talking specifically about the case where no data was lost, but an error was returned by the network stack and the error later went away. > On the whole I think the odds of re-syncing successfully are pretty bad, > and you'd be best off to pull the plug and start a new connection if you > see any networking failure. I guess that makes sense. But how do I know that the failure is a networking failure and not, say, an SQL-level failure? In my program, I mean, without human intervention? Jeroen