Re: Problem with executeBatch and "A result was returned when none was expected" - Mailing list pgsql-jdbc

From Oliver Jowett
Subject Re: Problem with executeBatch and "A result was returned when none was expected"
Date
Msg-id AANLkTikb2O676Sv7TEqOB0bNYrrXP-z+4a4J8Aj66X6z@mail.gmail.com
Whole thread Raw
In response to Re: Problem with executeBatch and "A result was returned when none was expected"  (Lew <noone@lewscanon.com>)
Responses Re: Problem with executeBatch and "A result was returned when none was expected"
List pgsql-jdbc
On 19 March 2011 11:49, Lew <noone@lewscanon.com> wrote:

> Sean Bowman wrote:
>>
>> Thanks for the quick response.  I'll switch it around to execute() each
>> prepared statement individually, and accumulate the generated ID's [sic].
>
> Why don't you try it batched without the RETURNING clause, and use
> 'getGeneratedKeys()' as the docs suggest?

There *is* no RETURNING clause in the application's original query
(see the code in the OP), that clause is being added by the driver to
implement Statement.RETURN_GENERATED_KEYS.

Merely requesting generated keys shouldn't really make executeBatch()
explode like this - the app is executing bare INSERTs as far as it
knows. We could definitely do better here.

Oliver

pgsql-jdbc by date:

Previous
From: Lew
Date:
Subject: Re: Problem with executeBatch and "A result was returned when none was expected"
Next
From: Oliver Jowett
Date:
Subject: Re: Problem with executeBatch and "A result was returned when none was expected"