Skip site navigation (1) Skip section navigation (2)

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 (view raw or flat)
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: TestSelectInto.java
Description: text/plain (562 bytes)

In response to

pgsql-jdbc by date

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

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group