Re: serial type; race conditions

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: jkakar(at)expressus(dot)com
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: serial type; race conditions
Date: 2001-03-26 21:47:37
Message-ID: 200103262147.QAA27340@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

> 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(at)candle(dot)pha(dot)pa(dot)us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message S.F. Lee 2001-03-27 01:39:56 Ygtq
Previous Message Tom Lane 2001-03-26 21:35:55 Re: Function Vanished