Received: from p1.selectacast.net (IDENT:root@p1.selectacast.net [206.41.1.251]) by hub.org (8.9.3/8.9.3) with ESMTP id WAA40746 for ; Mon, 6 Dec 1999 22:01:52 -0500 (EST) (envelope-from jks@p1.selectacast.net) Received: from selectacast.net (IDENT:jks@d1 [209.219.91.66]) by p1.selectacast.net (8.9.3/8.9.3) with ESMTP id VAA05891; Mon, 6 Dec 1999 21:59:42 -0500 Sender: jks@p1.selectacast.net Message-ID: <384C781E.F165774F@selectacast.net> Date: Mon, 06 Dec 1999 21:59:42 -0500 From: Joseph Shraibman Organization: Xtenit X-Mailer: Mozilla 4.7 [en] (X11; I; Linux 2.2.13 i686) X-Accept-Language: en MIME-Version: 1.0 To: Tom Lane CC: Gary Stainburn , "'Pgsql Interfaces'" Subject: Re: [INTERFACES] locking on database updates References: <20458.944529261@sss.pgh.pa.us> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Tom Lane wrote: > Gary Stainburn writes: > > My question is this. Is there a safe way of retrieving the next > > number from the parameter table in such a way that the same number > > cannot be retrieved twice. > > Use a SEQUENCE object for each "parameter table". This gives you > a well-tested, efficient generator mechanism. It may be "auto > generated" but you do have the option of resetting the sequence's > nextval and so forth, so I don't see that there is a good reason > to build a SEQUENCE substitute by hand. > > regards, tom lane > > ************ Can you give an example of sql that creates a table with that?