Received: from mc-qout2.whowhere.com (nytoday.whowhere.com [209.1.236.38]) by hub.org (8.10.1/8.10.1) with SMTP id e8LHJDs81343 for ; Thu, 21 Sep 2000 13:19:13 -0400 (EDT) Received: from Unknown/Local ([?.?.?.?]) by shared1-mail.whowhere.com; Thu Sep 21 10:18:51 2000 To: pgsql-general@hub.org Date: Thu, 21 Sep 2000 10:18:51 -0700 From: "K Parker" Message-ID: Mime-Version: 1.0 X-Sent-Mail: off Reply-To: kparker@eudoramail.com X-Expiredinmiddle: true X-Mailer: MailCity Service Subject: Re: sequences X-Sender-Ip: 209.191.185.54 Organization: QUALCOMM Eudora Web-Mail (http://www.eudoramail.com:80) Content-Type: text/plain; charset=us-ascii Content-Language: en Content-Transfer-Encoding: 7bit X-Archive-Number: 200009/616 Perhaps I was too brief before, wanting to spare folks long quotes from the manual that we all have, but here goes (quoting from http://www.postgresql.org/users-lounge/docs/7.0/postgres/sql-createsequence.htm): "After a sequence is created, you may use the function nextval(seqname) to get a new number from the sequence. The function currval('seqname') may be used to determine the number returned by the last call to nextval(seqname) for the specified sequence _in the current session_". [emphasis added] "Unexpected results may be obtained if a cache setting greater than one is used for a sequence object that will be used concurrently by multiple backends. Each backend will allocate and cache successive sequence values during one access to the sequence object and increase the sequence object's last_value accordingly. Then, the next cache-1 uses of nextval within that backend simply return the preallocated values without touching the shared object. So, numbers allocated but not used in the current session will be lost. __Furthermore, although multiple backends are guaranteed to allocate distinct sequence values, the values may be generated out of sequence when all the backends are considered.__" [again, emphasis added]. Join 18 million Eudora users by signing up for a free Eudora Web-Mail account at http://www.eudoramail.com