Thread: Re race condition and currval

Re race condition and currval

From
"K Parker"
Date:
> Is currval defined by the session or the current state of the sequence?

It's defined by the backend session.  Each connection handles its own value of currval() completely separate from the
others. When the sequence value is advanced (via a call to nextval()) the backend stores that value so it can respond
toany queries using currval(). The internal call to nextval() is completely outside  any transaction, and the sequence
numberis _never_ rolled back even if the to-be-added row's transaction is rolled back. 



Join 18 million Eudora users by signing up for a free Eudora Web-Mail account at http://www.eudoramail.com