Re race condition and currval - Mailing list pgsql-general

From K Parker
Subject Re race condition and currval
Date
Msg-id DDLEBFCNBOGOAAAA@shared1-mail.whowhere.com
Whole thread Raw
List pgsql-general
> 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

pgsql-general by date:

Previous
From: "Darrin Ladd"
Date:
Subject: Re: Removing all NOT NULL constraints from multiple tables easily
Next
From: Tim Kientzle
Date:
Subject: Re: PostgreSQL General Digest V1 #569