Re: Serial - Mailing list pgsql-sql

From Milen A. Radev
Subject Re: Serial
Date
Msg-id eut97i$n5f$1@sea.gmane.org
Whole thread Raw
In response to Re: Serial  ("Shavonne Marietta Wijesinghe" <shavonne.marietta@studioform.it>)
List pgsql-sql
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



pgsql-sql by date:

Previous
From: "Shavonne Marietta Wijesinghe"
Date:
Subject: Re: Serial
Next
From: "A. Kretschmer"
Date:
Subject: Re: Serial