Received: from localhost (maia-2.hub.org [200.46.204.187]) by postgresql.org (Postfix) with ESMTP id 496D69F9F47 for ; Thu, 14 Dec 2006 01:52:14 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.187]) (amavisd-new, port 10024) with ESMTP id 93714-02 for ; Thu, 14 Dec 2006 01:52:09 -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 D898C9F9F08 for ; Thu, 14 Dec 2006 01:52:09 -0400 (AST) Received: from 192.168.0.3 by www01.kensystem.com (SMTPD); id s20061214055201.100173; Thu, 14 Dec 2006 05:52:01 Message-ID: <4580E681.3080106@kensystem.com> Date: Wed, 13 Dec 2006 22:52:01 -0700 From: Ken Johanson User-Agent: Thunderbird 1.5.0.8 (Windows/20061025) MIME-Version: 1.0 To: pgsql-jdbc@postgresql.org Subject: Synthesize support for Statement.getGeneratedKeys()? Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200612/70 X-Sequence-Number: 16302 Hello, I've just come to realize that Statement.getGeneratedKeys() is not supported in the current PG and/or JDBC driver. Does someone know if this is a limitation of PG, or its protocol, or just not yet implemented in the JDBC driver? I'm just wondering where, if at all (if I have enough brain cells that is :), I could try to offer a patch or ideas.. Then question 2; I did see a discussion where it was suggested that we could get roughly the same effect by issuing a SELECT currval(''); after the DML... http://archives.postgresql.org/pgsql-jdbc/2005-10/msg00035.php Would it then be feasible internal to the JDBC driver to (create an option that would enable) always implicitly append that query to the (String)sql arg of Statment.executeUpdate(String sql, String[] columnNames)? I mean, just internally attempt to create the same behavior as what this method should be doing? Question 3 is, it seems like option two would only return the last created key, not set of keys, in the case where multiple rows were inserted.. is this accurate? Unfortunately if I cant find a way to make my target-app work with PG (without adding PG-specific modifications for getting keys), I'm probably not going to be able to make the switch to PG unfortunately - the code I'm working with makes really, really extensive use of retrieved keys.. Thank you, Ken