Re: Getting consecutive sequence values

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Dave Smith <dave(dot)smith(at)candata(dot)com>
Cc: nolan(at)celery(dot)tssi(dot)com, pgsql list <pgsql-general(at)postgresql(dot)org>
Subject: Re: Getting consecutive sequence values
Date: 2003-04-04 22:40:26
Message-ID: 10107.1049496026@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Dave Smith <dave(dot)smith(at)candata(dot)com> writes:
> I'm assuming that the setval would create an exclusive lock on the
> sequence until it is complete. Tom/Bruce?

But the setval() doesn't start to execute until some time after the
nextval() completes. The window during which you're executing the
addition of 100 would easily allow some other process to perform a
nextval(). Mike's right, this doesn't work.

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message nolan 2003-04-04 22:41:05 Re: dbmirror revisions
Previous Message Ed L. 2003-04-04 22:24:46 Re: Getting consecutive sequence values