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 49ED352BB8 for ; Wed, 27 Jul 2005 10:40:40 -0300 (ADT) 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 54136-06 for ; Wed, 27 Jul 2005 13:40:34 +0000 (GMT) Received: from mail.ecircle.de (mail.ecircle.de [195.140.186.200]) by svr1.postgresql.org (Postfix) with ESMTP id 88C0052B74 for ; Wed, 27 Jul 2005 10:40:30 -0300 (ADT) Received: from [192.168.1.110] (unknown [192.168.1.110]) by mail.ecircle.de (READY) with ESMTP id B8D2311D95A; Wed, 27 Jul 2005 15:40:32 +0200 (CEST) Subject: Re: INSERT and get ID From: Csaba Nagy To: Peter.Zoche@materna.de Cc: Postgres JDBC In-Reply-To: <3617A3C21370D045B75C0A40A7A6530D0B37E19A@ntexc2buc.do-office.buc.materna.com> References: <3617A3C21370D045B75C0A40A7A6530D0B37E19A@ntexc2buc.do-office.buc.materna.com> Content-Type: text/plain Message-Id: <1122471632.2837.79.camel@coppola.muc.ecircle.de> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.6 (1.4.6-2) Date: Wed, 27 Jul 2005 15:40:32 +0200 Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.013 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200507/359 X-Sequence-Number: 13507 It will be perfectly safe, as curval will return you the last value created in the current session. So you can be sure it's your value unless you use the same connection concurrently in different threads, but in that case you would have bigger problems :-) Cheers, Csaba. On Wed, 2005-07-27 at 15:29, Peter.Zoche@materna.de wrote: > > You have to do a a "SELECT curval('myseq')" after the insert. > > I had this in mind, too, but I am not sure if it is really safe if > there are several inserts at the same time... > > ---------------------------(end of broadcast)--------------------------- > TIP 6: explain analyze is your friend