Re: BUG #4617: JDBC Drivers 8.2/8.3 return no ResultSet

From: Raymond Naseef <naseef(at)egr(dot)msu(dot)edu>
To: Kris Jurka <books(at)ejurka(dot)com>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #4617: JDBC Drivers 8.2/8.3 return no ResultSet
Date: 2009-01-17 00:11:36
Message-ID: 49712238.5070701@egr.msu.edu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Excellent.

So useful getUpdateCount(), getResultSet(), and getMoreResults() return
very detailed data about each query in a statement.

Updating driver also found place we were using ps.setString(value) for a
parameter for ID = ?, and we got error asking for proper use of
ps.setInt(value).

Kris Jurka wrote:
>
>
> On Thu, 15 Jan 2009, Raymond L. Naseef wrote:
>
>>
>> The following bug has been logged online:
>>
>> Bug reference: 4617
>> PostgreSQL version: 8.3 & 7.4
>> Operating system: FreeBSD
>> Description: JDBC Drivers 8.2/8.3 return no ResultSet
>> Details:
>>
>> Below is query using temporary table instead of "IN" to greatly improve
>> performance. This worked in older JDBC driver, but no longer does. The
>> following were checked, making no difference:
>>
>> RESULT:
>> org.postgresql.util.PSQLException: No results were returned by the
>> query.
>>
>>
>> QUERY:
>> ------
>> create temporary table lookup_username (username varchar) on commit drop;
>> insert into lookup_username values ('naseef');
>> CREATE UNIQUE INDEX lookup_username_idx
>> ON lookup_username
>> USING btree
>> (username);
>>
>> SELECT enp.username, trim(enp.full_name)
>> FROM egr_nis_person as enp
>> JOIN lookup_username as lu
>> ON lu.username = enp.username
>> WHERE enp.start_date < now() + interval '30 seconds'
>> AND enp.end_date > now() + interval '30 seconds';
>>
>
> What's happening here is that you are actually issuing four commands,
> not a single query. The newer drivers will return a status for each
> command executed, and won't just give you the final select result. For
> multi-command statements you should use Statement.execute() and then
> getResultSet or getUpdateCount until getMoreResults is false.
>
> Kris Jurka
>

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Simon Keen 2009-01-18 09:19:24 BUG #4620: Unexpected(doc'd) side effects of using serial and rules
Previous Message Kris Jurka 2009-01-16 22:14:04 Re: BUG #4617: JDBC Drivers 8.2/8.3 return no ResultSet