Re: List last value of all sequences - Mailing list pgsql-general

From Stephan Szabo
Subject Re: List last value of all sequences
Date
Msg-id 20030724124940.B4080-100000@megazone.bigpanda.com
Whole thread Raw
In response to Re: List last value of all sequences  (greg@turnstep.com)
Responses Re: List last value of all sequences  (greg@turnstep.com)
List pgsql-general
On Thu, 24 Jul 2003 greg@turnstep.com wrote:

> > The main problem with this approach is that, while you get the "current
> > value", the sequence is incremented by the call. I just want to
> > (strictly) look at the value.
>
> The sequence values do not change: test it for yourself.

I'm not sure, but if another transaction wanted to do a nextval at "the
same time" couldn't the sequence of events end up going something like:

T1: nextval
T2: nextval
T1: setval(currval-1)

which would do the wrong thing since the next nextval would give the same
value that T2 already got?



pgsql-general by date:

Previous
From: Stephan Szabo
Date:
Subject: Re: Postgres unique index checking and atomic transactions
Next
From: Ron Johnson
Date:
Subject: Re: SAP DB: The unsung Open Source DB