Re: collision in serial numbers after INSERT?

From: Michael Glaesemann <grzm(at)seespotcode(dot)net>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: lawpoop(at)gmail(dot)com, pgsql-general(at)postgresql(dot)org
Subject: Re: collision in serial numbers after INSERT?
Date: 2007-06-01 20:50:17
Message-ID: ACDD9CBF-E03C-4D12-B194-3A7F9C28147E@seespotcode.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


On Jun 1, 2007, at 15:00 , Tom Lane wrote:

> Michael Glaesemann <grzm(at)seespotcode(dot)net> writes:
>> On May 31, 2007, at 11:46 , lawpoop(at)gmail(dot)com wrote:
>>> However, I wondered, if I were in an environment where there were
>>> many
>>> concurrent inserts, would it be possible that I didn't get the
>>> serial
>>> number of the insert that *I* just did?
>
>> No.
>
> Uh, yes, because he was using "SELECT last_value FROM seq" which is
> indeed subject to race conditions. currval() would be far safer.

I read that much too quickly. My apologies, lawpoop. And thanks, Tom.

Michael Glaesemann
grzm seespotcode net

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Alvaro Herrera 2007-06-01 20:50:30 Re: [Fwd: Re: Autovacuum keeps vacuuming a table disabled in pg_autovacuum]
Previous Message Ron St-Pierre 2007-06-01 20:27:14 [Fwd: Re: Autovacuum keeps vacuuming a table disabled in pg_autovacuum]