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 A40AE3A673A for ; Tue, 21 Dec 2004 19:11:32 +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 44149-08 for ; Tue, 21 Dec 2004 19:11:27 +0000 (GMT) Received: from renoir.unile.it (renoir.unile.it [193.204.78.15]) by svr1.postgresql.org (Postfix) with ESMTP id E35773A5F3E for ; Tue, 21 Dec 2004 19:11:26 +0000 (GMT) Received: from [193.204.74.244] ([193.204.74.244]) by renoir.unile.it (8.12.11/8.12.11) with ESMTP id iBLJAS2o025774 for ; Tue, 21 Dec 2004 20:10:28 +0100 Message-ID: <41C87558.6040206@unile.it> Date: Tue, 21 Dec 2004 20:11:20 +0100 From: Gabriele Carteni User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.3) Gecko/20040913 X-Accept-Language: en-us, en MIME-Version: 1.0 To: pgsql-jdbc@postgresql.org Subject: Re: currval bug?? References: <41C86BE5.2030501@unile.it> In-Reply-To: Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.215 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200412/155 X-Sequence-Number: 11821 Hi Kris and thank you for your fast answer.. my problem is to retrieve the last autogenerated key after an insert statement. 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 implemented. thanks! gaboc 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 >>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 > >---------------------------(end of broadcast)--------------------------- >TIP 5: Have you checked our extensive FAQ? > > http://www.postgresql.org/docs/faqs/FAQ.html > > > -- _____________________________________________________________ Ing. Gabriele Carteni Center for Advanced Computational Technologies / ISUFI University of Lecce, Italy office: +39.0832.298.122 ICQ#: 128087012 gpg --recv-keys --keyserver pgp.mit.edu 0x54E5C362 "Microsoft isn't the answer. Microsoft is the question, and my answer is no!"