X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 5F3343A4A78 for ; Fri, 19 Nov 2004 09:06:46 +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 19730-06 for ; Fri, 19 Nov 2004 09:06:41 +0000 (GMT) Received: from matrix.gatewaynet.com (matrix.gatewaynet.com [217.19.69.50]) by svr1.postgresql.org (Postfix) with ESMTP id 945263A4A2C for ; Fri, 19 Nov 2004 09:06:41 +0000 (GMT) Received: from matrix.gatewaynet.com (localhost.localdomain [127.0.0.1]) by matrix.gatewaynet.com (8.12.8/8.12.8) with ESMTP id iAJ9br5x013618; Fri, 19 Nov 2004 11:37:53 +0200 Received: from localhost (achill@localhost) by matrix.gatewaynet.com (8.12.8/8.12.8/Submit) with ESMTP id iAJ9brl9013614; Fri, 19 Nov 2004 11:37:53 +0200 Date: Fri, 19 Nov 2004 11:37:53 +0200 (EET) From: Achilleus Mantzios To: Erik Thiele Cc: pgsql-sql@postgresql.org Subject: Re: get sequence value of insert command In-Reply-To: <20041119094134.2437d867.erik@thiele-hydraulik.de> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=ISO-8859-7 Content-Transfer-Encoding: 8BIT X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200411/187 X-Sequence-Number: 19506 O Erik Thiele έγραψε στις Nov 19, 2004 : > hi > > create sequence mysequence; > > create table foo( > id integer default nextval('mysequence'), > bla text, > wombat integer, > foobar date, > primary key(id) > ); > > insert into foo (wombat) values (88); > > now how do i know the id of my newly inserted element? and > how can this be done in a completely concurrency safe way? The way to do this is by reading the docs :) use currval, it is session safe. > > > cya > erik > > ---------------------------(end of broadcast)--------------------------- > TIP 7: don't forget to increase your free space map settings > -- -Achilleus