Received: from maia.hub.org (unknown [200.46.204.183]) by mail.postgresql.org (Postfix) with ESMTP id C2CF36331C1 for ; Mon, 13 Jul 2009 17:23:49 -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 76021-01-2 for ; Mon, 13 Jul 2009 17:23:39 -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 C0DD463515A for ; Mon, 13 Jul 2009 17:23:13 -0300 (ADT) Received: from list by ciao.gmane.org with local (Exim 4.43) id 1MQS3M-00056u-Kx for pgsql-jdbc@postgresql.org; Mon, 13 Jul 2009 20:23:12 +0000 Received: from ppp-93-104-90-24.dynamic.mnet-online.de ([93.104.90.24]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 13 Jul 2009 20:23:12 +0000 Received: from spam_eater by ppp-93-104-90-24.dynamic.mnet-online.de with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 13 Jul 2009 20:23:12 +0000 X-Injected-Via-Gmane: http://gmane.org/ To: pgsql-jdbc@postgresql.org From: Thomas Kellerer Subject: Re: DELETE ... RETURNING Date: Mon, 13 Jul 2009 22:23:04 +0200 Lines: 22 Message-ID: References: <226a19190907131251m6c3786f5id8e8025f5c53cf66@mail.gmail.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: ppp-93-104-90-24.dynamic.mnet-online.de User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; de; rv:1.8.1.21) Gecko/20090302 Thunderbird/2.0.0.21 Mnenhy/0.7.5.666 In-Reply-To: <226a19190907131251m6c3786f5id8e8025f5c53cf66@mail.gmail.com> X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests=none X-Spam-Level: X-Archive-Number: 200907/25 X-Sequence-Number: 19793 Dennis Brakhane wrote on 13.07.2009 21:51: >> Am I missing something or is the "RETURNING" feature not supported by the >> driver? > > executeUpdate by definitionem can only return an int, the number of > rows affected. True, but the JDBC API also defines Statement.getMoreResults() and Statement.getResultSet() which could be used to return that information At least executeUpdate() should not throw an exception. > You probably can use stmt.executeQuery instead Actually execute() works without throwing an exception, but getMoreResults() and getResultSet() do not return the information about the deleted rows. Additionally when using execute(), getUpdateCount() will return -1 even if rows were deleted. Thomas