Received: from localhost (unknown [200.46.204.187]) by postgresql.org (Postfix) with ESMTP id 3CA9D9FC38F; Thu, 18 Oct 2007 18:00:14 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.187]) (amavisd-maia, port 10024) with ESMTP id 87404-02; Thu, 18 Oct 2007 17:59:59 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.5 X-Greylist: from auto-whitelisted by SQLgrey-1.7.5 Received: from tremor.opencloud.co.nz (tremor.opencloud.co.nz [131.203.101.230]) by postgresql.org (Postfix) with ESMTP id 926F19FC3CE; Thu, 18 Oct 2007 18:00:02 -0300 (ADT) Received: from 222-154-138-58.jetstream.xtra.co.nz ([222.154.138.58] helo=[10.1.1.3]) by tremor.opencloud.co.nz with esmtpsa (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.63) (envelope-from ) id 1IicTC-0001no-Sg; Fri, 19 Oct 2007 09:59:55 +1300 Message-ID: <4717C94D.7030605@opencloud.com> Date: Fri, 19 Oct 2007 09:59:57 +1300 From: Oliver Jowett User-Agent: Thunderbird 2.0.0.6 (Windows/20070728) MIME-Version: 1.0 To: Julius Stroffek CC: Tom Lane , pgsql-jdbc@postgresql.org, pgsql-bugs@postgresql.org Subject: Re: [JDBC] Re: 'on insert do instead' rule with a where clause responds 'INSERT 0 0' References: <46E16058.4070602@Sun.COM> <22418.1189179363@sss.pgh.pa.us> <47175D85.4080801@sun.com> In-Reply-To: <47175D85.4080801@sun.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200710/140 X-Sequence-Number: 18538 Julius Stroffek wrote: > There is only one option that comes to my mind - always return > Statment.SUCCESS_NO_INFO in executeBatch (or possibly only depending on > some java property). I can not see any simple solution for > Statement.executeUpdate since the number of rows affected may differ > depending on the rules and might be also difficult to calculate. The server is reporting to the driver that zero rows were affected (not "unknown", *zero*) so I don't see any reason why the driver should not report that as the number of rows affected. Returning SUCCESS_NO_INFO reduces the usefulness of the driver in the other 98% of cases where there are no INSTEAD rules. The protocol docs say: > CommandComplete (B) [...] > For an INSERT command, the tag is INSERT oid rows, where rows is the number of rows inserted. oid is the object ID of the inserted row if rows is 1 and the target table has OIDs; otherwise oid is 0. So if the server is not returning "the number of rows inserted" then either the server has a bug or the protocol docs are wrong. -O