Re: List last value of all sequences

From: Stephan Szabo <sszabo(at)megazone(dot)bigpanda(dot)com>
To: <greg(at)turnstep(dot)com>
Cc: <pgsql-general(at)postgresql(dot)org>
Subject: Re: List last value of all sequences
Date: 2003-07-24 19:54:09
Message-ID: 20030724124940.B4080-100000@megazone.bigpanda.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Thu, 24 Jul 2003 greg(at)turnstep(dot)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?

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Sanjay Manandhar 2003-07-24 20:32:14 COPY command
Previous Message Ron Johnson 2003-07-24 19:50:18 Re: SAP DB: The unsung Open Source DB