Received: from maia.hub.org (unknown [200.46.204.183]) by mail.postgresql.org (Postfix) with ESMTP id 0581B63247B for ; Tue, 14 Jul 2009 03:29:06 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 60233-07 for ; Tue, 14 Jul 2009 03:28:55 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from ciao.gmane.org (main.gmane.org [80.91.229.2]) by mail.postgresql.org (Postfix) with ESMTP id 776FE632269 for ; Tue, 14 Jul 2009 03:28:55 -0300 (ADT) Received: from list by ciao.gmane.org with local (Exim 4.43) id 1MQbVR-0002fr-Ry for pgsql-jdbc@postgresql.org; Tue, 14 Jul 2009 06:28:49 +0000 Received: from 217.110.94.67 ([217.110.94.67]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 14 Jul 2009 06:28:49 +0000 Received: from spam_eater by 217.110.94.67 with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 14 Jul 2009 06:28:49 +0000 X-Injected-Via-Gmane: http://gmane.org/ To: pgsql-jdbc@postgresql.org From: Thomas Kellerer Subject: Re: DELETE ... RETURNING Date: Tue, 14 Jul 2009 08:28:39 +0200 Lines: 21 Message-ID: References: <226a19190907131251m6c3786f5id8e8025f5c53cf66@mail.gmail.com> <4A5BAA29.9000004@opencloud.com> <4A5BB6B3.3020002@opencloud.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: 217.110.94.67 User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.22) Gecko/20090605 Thunderbird/2.0.0.22 Mnenhy/0.7.6.666 In-Reply-To: <4A5BB6B3.3020002@opencloud.com> X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=2.599 tagged_above=0 required=5 tests=RCVD_NUMERIC_HELO=2.599 X-Spam-Level: ** X-Archive-Number: 200907/32 X-Sequence-Number: 19800 Oliver Jowett, 14.07.2009 00:35: > I took another look at this, and your code assumes that the update count > is the first result. It's not. In the case where both a resultset and an > update count are present in a single query, the driver puts the > resultset result first (so that executeQuery() works nicely). > > So your first call to getUpdateCount() returns -1 because the current > result is a resultset, not an update count (see the javadoc). Then you > call getMoreResults() which moves to the 2nd result (the update count) > and returns false because there's no resultset (again, see the javadoc). > > If you want a general-purpose result processing loop The perils of quick and dirty test programs... I actually have that generic loop already, just failed to think it through completely before posting ;) Sorry for the trouble and thanks for the help. Regards Thomas