Received: from maia.hub.org (maia-2.hub.org [200.46.204.251]) by mail.postgresql.org (Postfix) with ESMTP id 930151337B96 for ; Fri, 22 Apr 2011 17:25:31 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.251]) (amavisd-maia, port 10024) with ESMTP id 18504-07 for ; Fri, 22 Apr 2011 20:25:09 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from gw.wicourts.gov (gwmta.wicourts.gov [165.219.244.99]) by mail.postgresql.org (Postfix) with ESMTP id 779011337B47 for ; Fri, 22 Apr 2011 17:25:09 -0300 (ADT) Received: from Courts-MTA by gw.wicourts.gov with Novell_GroupWise; Fri, 22 Apr 2011 15:25:08 -0500 Message-Id: <4DB19DD1020000250003CC02@gw.wicourts.gov> X-Mailer: Novell GroupWise Internet Agent 8.0.1 Date: Fri, 22 Apr 2011 15:25:05 -0500 From: "Kevin Grittner" To: "Craig James" , "pgsql-admin@postgresql.org" Subject: Re: select for update References: <4DB1BFC2.7020806@emolecules.com> In-Reply-To: <4DB1BFC2.7020806@emolecules.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Content-Disposition: inline X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.91 tagged_above=-10 required=5 tests=BAYES_00=-1.9, T_RP_MATCHES_RCVD=-0.01 X-Spam-Level: X-Archive-Number: 201104/212 X-Sequence-Number: 37393 Craig James wrote: > The sequence of operations goes like this (pseudo-code): > The problem is that very occasionally the same ID will be issued > twice. I don't see how this can be. Doesn't the "for update" > guarantee that no other process can claim that same row? I don't see a flaw in the pseudo-code (other than an apparent typo on the insert). Can you show the actual code? -Kevin