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

Re: currval bug??

From: Gabriele Carteni <gabriele(dot)carteni(at)unile(dot)it>
To: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: currval bug??
Date: 2004-12-21 19:11:20
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-jdbc
Hi Kris and thank you for your fast answer..

my problem is to retrieve the last autogenerated key after an insert 
i always used this method (mashing queries together where the last is a 
currval query).
What i should use to have the same result in pgsql8?

i apologize that java.sql.Statement.getGeneratedKeys() isn't still 


Kris Jurka wrote:

>On Tue, 21 Dec 2004, Gabriele Carteni wrote:
>>Hi all,
>>i have recently upgraded my development environment:
>>FROM postgresql 7.4 TO postgresql 8.0beta5
>>FROM jdk1.4 TO jdk1.5
>>FROM pg74.215.jdbc3.jar TO pg80b1.308.jdbc3.jar
>>now, i have a FRUSTRATING bug:
>>With this query (which works fine with previous pg74jdbc):
>>*insert into tablename (fieldname) values ('testvalue');select 
>>*org.postgresql.util.PSQLException: No results were returned by the query.*
>>Obviously the query has to return a result.
>The 7.4 driver sends the whole query string together to the backend and 
>gets a result.  The 8.0 driver splits the query into two and sends them 
>individually.  This is required to use the V3 extended query protocol.  
>When it gets the result from the first part it is expecting a result and 
>isn't getting one.  I'm not sure if this should be an error or not, in 
>general mashing queries together isn't a great idea.  Perhaps you should 
>be using Statement.execute() and then iterating through any/all results 
>Kris Jurka
>---------------------------(end of broadcast)---------------------------
>TIP 5: Have you checked our extensive FAQ?

Ing. Gabriele Carteni
Center for Advanced Computational Technologies / ISUFI
University of Lecce, Italy 

office: +39.0832.298.122
ICQ#: 128087012

gpg --recv-keys --keyserver 0x54E5C362

"Microsoft isn't the answer. Microsoft is the question, and my answer is no!"

In response to


pgsql-jdbc by date

Next:From: Kris JurkaDate: 2004-12-21 19:57:58
Subject: Re: currval bug??
Previous:From: Kris JurkaDate: 2004-12-21 18:48:45
Subject: Re: currval bug??

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