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 B846F3A4A31 for ; Fri, 19 Nov 2004 09:27:06 +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 26234-05 for ; Fri, 19 Nov 2004 09:26:58 +0000 (GMT) Received: from anchor-post-34.mail.demon.net (anchor-post-34.mail.demon.net [194.217.242.92]) by svr1.postgresql.org (Postfix) with ESMTP id E24A53A4A6D for ; Fri, 19 Nov 2004 09:26:56 +0000 (GMT) Received: from mwynhau.demon.co.uk ([193.237.186.96] helo=mainbox.archonet.com) by anchor-post-34.mail.demon.net with esmtp (Exim 4.42) id 1CV52d-000Jyj-Ez; Fri, 19 Nov 2004 09:26:56 +0000 Received: from [192.168.1.17] (client17.archonet.com [192.168.1.17]) by mainbox.archonet.com (Postfix) with ESMTP id 299B816314; Fri, 19 Nov 2004 09:26:53 +0000 (GMT) Message-ID: <419DBC5C.807@archonet.com> Date: Fri, 19 Nov 2004 09:26:52 +0000 From: Richard Huxton User-Agent: Mozilla Thunderbird 0.9 (X11/20041103) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Achilleus Mantzios Cc: Erik Thiele , pgsql-sql@postgresql.org Subject: Re: get sequence value of insert command References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-7; format=flowed Content-Transfer-Encoding: 7bit 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/189 X-Sequence-Number: 19508 Achilleus Mantzios wrote: >> >>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. The increase in this question suggests the number of new users has increased since 8.0 went into beta-test. It's pretty much the first question anyone asks. I seem to recall it was mine. I made the mistake of assuming it wasn't concurrency safe and was gently corrected by one of the community. I think it might have been a Tim/Tam Lane. Wonder what happened to him? :-) -- Richard Huxton Archonet Ltd