Received: from localhost (maia-1.hub.org [200.46.204.191]) by postgresql.org (Postfix) with ESMTP id A26D49FB794 for ; Tue, 3 Apr 2007 07:11:33 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.191]) (amavisd-maia, port 10024) with ESMTP id 32727-09 for ; Tue, 3 Apr 2007 07:11:29 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.4 Received: from ciao.gmane.org (main.gmane.org [80.91.229.2]) by postgresql.org (Postfix) with ESMTP id 6A65B9FB6B6 for ; Tue, 3 Apr 2007 07:11:29 -0300 (ADT) Received: from list by ciao.gmane.org with local (Exim 4.43) id 1HYfyn-0008F9-5S for pgsql-sql@postgresql.org; Tue, 03 Apr 2007 12:11:09 +0200 Received: from pirus.securax.be ([213.16.46.130]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 03 Apr 2007 12:11:09 +0200 Received: from milen by pirus.securax.be with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 03 Apr 2007 12:11:09 +0200 X-Injected-Via-Gmane: http://gmane.org/ To: pgsql-sql@postgresql.org From: "Milen A. Radev" Subject: Re: Serial Date: Tue, 03 Apr 2007 13:10:58 +0300 Lines: 34 Message-ID: References: <008301c775d1$4b224420$1102a8c0@dream> <20070403093222.GB30108@a-kretschmer.de> <00b101c775d6$2d313840$1102a8c0@dream> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Complaints-To: usenet@sea.gmane.org X-Gmane-NNTP-Posting-Host: pirus.securax.be User-Agent: Thunderbird 2.0b2 (Windows/20070116) In-Reply-To: <00b101c775d6$2d313840$1102a8c0@dream> X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200704/21 X-Sequence-Number: 28021 Shavonne Marietta Wijesinghe wrote: > thanks. I read the page you gave. > > CREATE SEQUENCE seq_mytable_n_gen; > > CREATE TABLE mytable > ( > n_gen int nextval('seq_mytable_n_gen'), > mycolumn1 int, > mycolumn2 int > ); > > > i tried creating it like that. The sequence was created without any > error. But for the create table i get > > ERROR: syntax error at or near "nextval" at character 38 > > What should i do? Add the missing "default": CREATE TABLE mytable ( n_gen int DEFAULT nextval('seq_mytable_n_gen'), mycolumn1 int, mycolumn2 int ); -- Milen A. Radev