pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Oliver Jowett <oliver@opencloud.com>
To: Guy Rouillier <guy-rouillier@speakeasy.net>
Cc: PostgreSQL JDBC <pgsql-jdbc@postgresql.org>
Subject: Re: Calling stored functions in executeBatch
Date: Tue, 15 Mar 2005 08:39:18 +1300
Message-ID: <4235E866.50100@opencloud.com> (raw)
In-Reply-To: <20050313204039.02ef22fb@emach>
References: <20050311192134.6aad0052@emach>
	<20050313204039.02ef22fb@emach>

Guy Rouillier wrote:

> Answering the last part of my own question.  I wrote a simple program to
> execute my stored procedure using the call escape mechanism:
> 
>     CallableStatement s = conn.prepareCall("{ call insert_t1(?)}");

> Exception caught: org.postgresql.util.PSQLException: A result was
> returned when none was expected.
> 
> So my conclusion is that you simply can't use PostgreSQL stored
> functions with batches.

At the moment, no. The { call } escape is currently translated to a 
SELECT. I suppose we could do a special case to handle batching of that 
(ignoring the "unexpected" resultset because we know there's no real 
result there), but it seems pretty hairy, and I think the JDBC spec only 
requires INSERT/UPDATE/DELETE to be supported.

> At the very least, warn people that it is possible to get committed
> changes followed by an exception.

Well, that's generally true when using autocommit anyway. Consider a 
network or server failure just after the implicit commit but before the 
client has seen the response.

-O



view thread (3+ messages)

Message-ID: <4235E866.50100@opencloud.com>
Permalink:  ../4235E866.50100@opencloud.com/
Also on:    postgresql.org/message-id/4235E866.50100@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, guy-rouillier@speakeasy.net
  Subject: Re: Calling stored functions in executeBatch
  In-Reply-To: <4235E866.50100@opencloud.com>
  References: <20050311192134.6aad0052@emach> <20050313204039.02ef22fb@emach> <4235E866.50100@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