Re race condition and currval

From: "K Parker" <kparker(at)eudoramail(dot)com>
To: pgsql-general(at)hub(dot)org
Subject: Re race condition and currval
Date: 2000-09-11 18:23:43
Message-ID: DDLEBFCNBOGOAAAA@shared1-mail.whowhere.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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 to any queries using currval(). The internal call to nextval() is completely outside any transaction, and the sequence number is _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

Browse pgsql-general by date

  From Date Subject
Next Message Peter Mount 2000-09-11 20:50:56 Re: port from MSSQLServer to PostgreSQL
Previous Message Tim Kientzle 2000-09-11 18:23:21 Re: PostgreSQL General Digest V1 #569