Re: executeUpdate("SELECT INTO")

From: Oliver Jowett <oliver(at)opencloud(dot)com>
To: Joseph Shraibman <jks(at)selectacast(dot)net>
Cc: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: executeUpdate("SELECT INTO")
Date: 2005-03-15 05:56:35
Message-ID: 42367913.8070704@opencloud.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

Joseph Shraibman wrote:
> How come executeUpdate() always returns 1 when the sql is SELECT ...
> INTO TEMP tablename ? I'm using pg 7.4.7

I just tried the CVS driver against 7.4.6 and 8.0.0 servers, and both
return 0 in this case, regardless of the actual number of rows inserted.
I don't have a 7.4.7 build to hand, but I'd expect it to behave the same
as 7.4.6.

Returning 0 is ok according to the JDBC spec, which says that
executeUpdate returns "either the row count for INSERT, UPDATE or DELETE
statements, or 0 for SQL statements that return nothing". We can't
return a row count here anyway, as the server doesn't tell us the number
of rows inserted by a SELECT INTO.

If you're seeing a return value of 1, that does seem wrong. Can you
provide some test code showing the problem? We'd also need to know
exactly which driver build you are using.

The test code I used is attached.

-O

Attachment Content-Type Size
TestSelectInto.java text/plain 562 bytes

In response to

Browse pgsql-jdbc by date

  From Date Subject
Next Message Javier Yáñez 2005-03-16 09:30:03 Charset encoding patch to JDBC driver
Previous Message Joseph Shraibman 2005-03-15 04:58:09 executeUpdate("SELECT INTO")