Re: using sequences - Mailing list pgsql-general

From Ernest E Vogelsinger
Subject Re: using sequences
Date
Msg-id 5.1.1.6.2.20030613231141.03c04618@mail.vogelsinger.at
Whole thread Raw
In response to Re: using sequences  (Thomas Kellerer <spam_eater@gmx.net>)
List pgsql-general
At 23:03 13.06.2003, Thomas Kellerer said:
--------------------[snip]--------------------
>I think the other explenations where pretty good. However there *is* a way
>to retrieve the "current value" of sequence regardless whether nextval was
>called or not:
>
>SELECT last_value FROM news_news_id_seq;
--------------------[snip]--------------------

Yup, but it's not always 100% accurate - at the time you're receiving the
result set another process/connection could already have updated the value.
You don't have a guarantee of uniqueness when SELECTing (except you're
using some collaboration-unfriendly lock...)


--
   >O     Ernest E. Vogelsinger
   (\)    ICQ #13394035
    ^     http://www.vogelsinger.at/



pgsql-general by date:

Previous
From: Thomas Kellerer
Date:
Subject: Re: using sequences
Next
From: The Hermit Hacker
Date:
Subject: Re: [HACKERS] SAP and MySQL ... [and Benchmark]