X-Original-To: pgsql-jdbc-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 4E9FE3A1990 for ; Tue, 21 Dec 2004 18:47:16 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 20175-07 for ; Tue, 21 Dec 2004 18:47:05 +0000 (GMT) Received: from mail63.csoft.net (leary3.csoft.net [63.111.22.74]) by svr1.postgresql.org (Postfix) with SMTP id D046B3A59C9 for ; Tue, 21 Dec 2004 18:47:03 +0000 (GMT) Received: (qmail 20075 invoked by uid 1112); 21 Dec 2004 18:48:45 -0000 Date: Tue, 21 Dec 2004 13:48:45 -0500 (EST) From: Kris Jurka X-X-Sender: books@leary.csoft.net To: Gabriele Carteni Cc: pgsql-jdbc@postgresql.org Subject: Re: currval bug?? In-Reply-To: <41C86BE5.2030501@unile.it> Message-ID: References: <41C86BE5.2030501@unile.it> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.014 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200412/154 X-Sequence-Number: 11820 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 > currval('tablename_id_seq');* > > *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 returned? Kris Jurka