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 1F45B8BAFAA for ; Sun, 20 Feb 2005 16:48:17 +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 13005-08 for ; Sun, 20 Feb 2005 16:48:11 +0000 (GMT) Received: from net2.micro-automation.com (net2.micro-automation.com [64.7.141.29]) by svr1.postgresql.org (Postfix) with SMTP id 9E5F98BAFA5 for ; Sun, 20 Feb 2005 16:48:08 +0000 (GMT) Received: (qmail 10203 invoked from network); 20 Feb 2005 16:47:16 -0000 Received: from dcdsl.ebox.com (HELO ?192.168.1.36?) (davec@64.7.143.116) by net2.micro-automation.com with SMTP; 20 Feb 2005 16:47:16 -0000 Message-ID: <4218BF41.8090808@fastcrypt.com> Date: Sun, 20 Feb 2005 11:48:01 -0500 From: Dave Cramer Reply-To: pg@fastcrypt.com Organization: Postgres International User-Agent: Mozilla Thunderbird 1.0 (X11/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Kris Jurka Cc: =?ISO-8859-15?Q?Sven_K=F6hler?= , pgsql-jdbc@postgresql.org Subject: Re: How to get generated primary key? References: In-Reply-To: Content-Type: multipart/alternative; boundary="------------010806050200030404080803" X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.112 tagged_above=0 required=5 tests=AWL, HTML_40_50, HTML_MESSAGE, HTML_TITLE_EMPTY X-Spam-Level: X-Archive-Number: 200502/140 X-Sequence-Number: 12320 This is a multi-part message in MIME format. --------------010806050200030404080803 Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 8bit Apparently there is work going on to support sql2003 generated keys. On the upside you are guaranteed that they truly work now as opposed to some other db's. Dave Kris Jurka wrote: >On Sat, 19 Feb 2005, [ISO-8859-15] Sven Köhler wrote: > > > >>i know about the nextval and currval functions, but i don't like them, >>since they don't apply to tables. To get the generated key, you have to >>know the name of the sequence, not just the name of the table. >> >> > >8.0 now offers the pg_get_serial_sequence function which may help you out. > > > >>Does the JDBC-Driver implement the getGeneratedKeys() method? >> >> > >No, see the many discussions of this in the archives, for example: > >http://gborg.postgresql.org/project/pgjdbc/bugs/bugupdate.php?984 > >http://archives.postgresql.org/pgsql-jdbc/2004-09/msg00190.php > >Kris Jurka > >---------------------------(end of broadcast)--------------------------- >TIP 8: explain analyze is your friend > > > > -- Dave Cramer http://www.postgresintl.com 519 939 0336 ICQ#14675561 --------------010806050200030404080803 Content-Type: text/html; charset=ISO-8859-15 Content-Transfer-Encoding: 8bit Apparently there is work going on to support sql2003 generated keys.

On the upside you are guaranteed that they truly work now as opposed to some other db's.

Dave

Kris Jurka wrote:
On Sat, 19 Feb 2005, [ISO-8859-15] Sven Köhler wrote:

  
i know about the nextval and currval functions, but i don't like them, 
since they don't apply to tables. To get the generated key, you have to 
know the name of the sequence, not just the name of the table.
    

8.0 now offers the pg_get_serial_sequence function which may help you out.

  
Does the JDBC-Driver implement the getGeneratedKeys() method?
    

No, see the many discussions of this in the archives, for example:

http://gborg.postgresql.org/project/pgjdbc/bugs/bugupdate.php?984

http://archives.postgresql.org/pgsql-jdbc/2004-09/msg00190.php

Kris Jurka

---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend


  

-- 
Dave Cramer
http://www.postgresintl.com
519 939 0336
ICQ#14675561
--------------010806050200030404080803--