Received: from candle.pha.pa.us (candle.navpoint.com [162.33.245.46]) by mail.postgresql.org (8.11.3/8.11.1) with ESMTP id f2QLlqw70773 for ; Mon, 26 Mar 2001 16:47:52 -0500 (EST) (envelope-from pgman@candle.pha.pa.us) Received: (from pgman@localhost) by candle.pha.pa.us (8.9.0/8.9.0) id QAA27340; Mon, 26 Mar 2001 16:47:37 -0500 (EST) From: Bruce Momjian Message-Id: <200103262147.QAA27340@candle.pha.pa.us> Subject: Re: serial type; race conditions In-Reply-To: <20010326132728.A15965@expressus.com> "from jkakar@expressus.com at Mar 26, 2001 01:27:28 pm" To: jkakar@expressus.com Date: Mon, 26 Mar 2001 16:47:37 -0500 (EST) CC: pgsql-sql@postgresql.org X-Mailer: ELM [version 2.4ME+ PL77 (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-Archive-Number: 200103/541 X-Sequence-Number: 2211 > Hi, > > I'm using serial fields to generate IDs for almost all object in my > database. I insert an empty row, get the CURRVAL() of the sequence > and then update to that value. > > I had understood (and now, I can't find the reference to back this up) > that serial is implemented in such a way that race conditions between > DB connections can't happen. > > Is this true? Safe. See FAQ item. currval is for your backend only. -- Bruce Momjian | http://candle.pha.pa.us pgman@candle.pha.pa.us | (610) 853-3000 + If your life is a hard drive, | 830 Blythe Avenue + Christ can be your backup. | Drexel Hill, Pennsylvania 19026