Received: from localhost (maia-4.hub.org [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id AB9A89FB1A5 for ; Sat, 27 Jan 2007 00:33:57 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-new, port 10024) with ESMTP id 38808-08 for ; Sat, 27 Jan 2007 00:33:55 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey-1.7.4 Received: from www01.kensystem.com (www01.kensystem.com [72.19.170.120]) by postgresql.org (Postfix) with ESMTP id A6B299FB214 for ; Sat, 27 Jan 2007 00:33:54 -0400 (AST) Received: from 192.168.0.3 by www01.kensystem.com (SMTPD); id s20070127043352.19859; Sat, 27 Jan 2007 04:33:52 Message-ID: <45BAD630.8020209@kensystem.com> Date: Fri, 26 Jan 2007 21:33:52 -0700 From: Ken Johanson User-Agent: Thunderbird 1.5.0.9 (Windows/20061207) MIME-Version: 1.0 To: Dave Cramer CC: pgsql-jdbc@postgresql.org Subject: Re: Synthesize support for Statement.getGeneratedKeys()? References: <4580E681.3080106@kensystem.com> <45B9A9D6.2080100@kensystem.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200701/171 X-Sequence-Number: 16536 Dave Cramer wrote: > Ken, > > Do you have a test case ? What do the server logs show ? > Hi Dave, My test case is: String url = "jdbc:postgresql://127.0.0.1:5432/test?stringtype=unspecified"; String clz = "org.postgresql.Driver"; String dml = "insert into contact (rowid,logonname) values (DEFAULT,'bar')"; String[] keys = {"rowid"}; Connection con = DriverManager.getConnection(url, "user", "pass"); Statement stmt = con.createStatement(); int affected = stmt.executeUpdate(dml, keys); ResultSet rs = stmt.getGeneratedKeys(); if (rs.next()) out.println(rs.getObject(1)); else out.println("NO ROWS, INSERTED "+affected); A ResultSet is returned but has no rows. The insert does succeed and a sequence generated key increments in the 'rowid' column. I think the issue is just that my code is not calling through the correct private methods that would populate a result. Also I noticed that so far my mods have not implemented Stmt.NO_GENERATED_KEYS & RETURN_GENERATED_KEYS; On a related note, do you know how I could call though a Stream method instead of the String/Charsequence execs? Thanks, Ken