Re: using sequences

From: Ernest E Vogelsinger <ernest(at)vogelsinger(dot)at>
To: Thomas Kellerer <spam_eater(at)gmx(dot)net>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: using sequences
Date: 2003-06-13 21:14:43
Message-ID: 5.1.1.6.2.20030613231141.03c04618@mail.vogelsinger.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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/

In response to

Browse pgsql-general by date

  From Date Subject
Next Message The Hermit Hacker 2003-06-13 21:16:52 Re: [HACKERS] SAP and MySQL ... [and Benchmark]
Previous Message scott.marlowe 2003-06-13 21:10:28 Re: How to change column type in PostgreSQL 7.1.2