pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Thomas Kellerer <spam_eater@gmx.net>
To: pgsql-jdbc@postgresql.org
Subject: Re: DELETE ... RETURNING
Date: Mon, 13 Jul 2009 22:23:04 +0200
Message-ID: <h3g536$kq4$1@ger.gmane.org> (raw)
In-Reply-To: <226a19190907131251m6c3786f5id8e8025f5c53cf66@mail.gmail.com>
References: <h3g2rn$dn8$1@ger.gmane.org>
	<226a19190907131251m6c3786f5id8e8025f5c53cf66@mail.gmail.com>

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





view thread (10+ messages)  latest in thread

Message-ID: <h3g536$kq4$1@ger.gmane.org>
Permalink:  ../h3g536$kq4$1@ger.gmane.org/
Also on:    postgresql.org/message-id/h3g536$kq4$1@ger.gmane.org

 · 

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: spam_eater@gmx.net
  Subject: Re: DELETE ... RETURNING
  In-Reply-To: <h3g536$kq4$1@ger.gmane.org>
  References: <h3g2rn$dn8$1@ger.gmane.org> <226a19190907131251m6c3786f5id8e8025f5c53cf66@mail.gmail.com> <h3g536$kq4$1@ger.gmane.org>

* 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