Received: from proxy.bazzanese.com (root@ip161.tol11.interbusiness.it [195.120.106.161]) by hub.org (8.8.8/8.7.5) with ESMTP id HAA15606 for ; Tue, 19 May 1998 07:08:15 -0400 (EDT) Received: from localhost (sferac@localhost) by proxy.bazzanese.com (8.8.8/8.8.8/Debian/GNU) with SMTP id JAA00422; Tue, 19 May 1998 09:45:19 GMT Date: Tue, 19 May 1998 09:45:18 +0000 (UTC) From: "Jose' Soares Da Silva" X-Sender: sferac@proxy.bazzanese.com To: Jerome Knobl cc: wwwadmin@wizard.ca, PGsql Subject: Re: [SQL] How to handle a requirement for nextval In-Reply-To: <35612D1E.CC49CA67@mandanet.ch> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII On Tue, 19 May 1998, Jerome Knobl wrote: > I have got the same trouble. I found a first inellegant solution. Is to > create a function which make an increment like that : > create function last98_20_rubriques() returns int4 > as 'Select max(ref98_20_rubriques) as next from DB98_20_rubriques;' > language 'sql'; > > But I read yesterday that I have to use e SEQUENCE like : > > create table toto (id int4 PRIMARY KEY, test varchar); > create sequence step1 increment 1 start 1000 minvalue 1000 maxvalue > 999999; > > And after that I have normaly to do : > insert into toto (id,test) values (step1.nextval,'sdf'); > But It's don't work. > If you can go further send me a mail (and sorry for my very bad english). insert into toto (id,test) values (nextval('step1'),'sdf'); Jose'