pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Oliver Jowett <oliver@opencloud.com>
To: Julius Stroffek <Julius.Stroffek@Sun.COM>
Cc: Tom Lane <tgl@sss.pgh.pa.us>
Cc: pgsql-jdbc@postgresql.org
Cc: pgsql-bugs@postgresql.org
Subject: Re: [JDBC] Re: 'on insert do instead' rule with a where clause responds 'INSERT 0 0'
Date: Fri, 19 Oct 2007 09:59:57 +1300
Message-ID: <4717C94D.7030605@opencloud.com> (raw)
In-Reply-To: <47175D85.4080801@sun.com>
References: <46E16058.4070602@Sun.COM>
	<22418.1189179363@sss.pgh.pa.us>
	<47175D85.4080801@sun.com>

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



view thread (4+ messages)

Message-ID: <4717C94D.7030605@opencloud.com>
Permalink:  ../4717C94D.7030605@opencloud.com/
Also on:    postgresql.org/message-id/4717C94D.7030605@opencloud.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-jdbc@postgresql.org
  Cc: oliver@opencloud.com, Julius.Stroffek@Sun.COM, tgl@sss.pgh.pa.us, pgsql-bugs@postgresql.org
  Subject: Re: [JDBC] Re: 'on insert do instead' rule with a where clause responds 'INSERT 0 0'
  In-Reply-To: <4717C94D.7030605@opencloud.com>
  References: <46E16058.4070602@Sun.COM> <22418.1189179363@sss.pgh.pa.us> <47175D85.4080801@sun.com> <4717C94D.7030605@opencloud.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox