Received: from localhost (unknown [200.46.208.211]) by mail.postgresql.org (Postfix) with ESMTP id 73CC463299C for ; Wed, 25 Nov 2009 08:30:41 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.208.211]) (amavisd-maia, port 10024) with ESMTP id 34382-03 for ; Wed, 25 Nov 2009 12:30:06 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from lo.gmane.org (lo.gmane.org [80.91.229.12]) by mail.postgresql.org (Postfix) with ESMTP id A727A63279E for ; Wed, 25 Nov 2009 08:30:30 -0400 (AST) Received: from list by lo.gmane.org with local (Exim 4.50) id 1NDH0t-00088q-4q for pgsql-jdbc@postgresql.org; Wed, 25 Nov 2009 13:30:27 +0100 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 ; Wed, 25 Nov 2009 13:30:27 +0100 Received: from spam_eater by 217.110.94.67 with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 25 Nov 2009 13:30:27 +0100 X-Injected-Via-Gmane: http://gmane.org/ To: pgsql-jdbc@postgresql.org From: Thomas Kellerer Subject: Re: getUdateCount() vs. RETURNING clause Date: Wed, 25 Nov 2009 13:30:17 +0100 Lines: 24 Message-ID: References: <4B0C7CFE.50106@opencloud.com> <4B0D1164.1060006@opencloud.com> <4B0D2014.3060703@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.23) Gecko/20090812 Thunderbird/2.0.0.23 Mnenhy/0.7.6.666 In-Reply-To: <4B0D2014.3060703@opencloud.com> X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.955 tagged_above=-10 required=5 tests=AWL=-0.372, BAYES_20=-0.74, RCVD_NUMERIC_HELO=2.067 X-Spam-Level: X-Archive-Number: 200911/28 X-Sequence-Number: 20075 Oliver Jowett, 25.11.2009 13:16: >> So if I create a loop using the condition stated in the Javadocs the >> program flow would be as follows: >> >> 1) stmt.execute() returns true, so I call getResultSet() >> 2) getMoreResults() returns false, but getUpdateCount() returns 3 ==> go on >> 3) getMoreResults() returns false, but getUpdateCount() returns 2 ==> go on >> 4) getMoreResults() returns true, so getResultSet() returns a result set >> ==> go on >> 5) getMoreResults() returns true, so getResultSet() returns a result set >> ==> go on >> 6) getMoreResults() returns false, getUpdateCount() returns -1 ==> >> everything was processed. > > Yes, this is correct. It will look something like this: So my understanding was correct ;) Back to my original question then: why doesn't the Postgres driver return 1 as the updateCount in this situation? I only get a single result set (which is correct) but never a 1 as the update count. Regards Thomas