Re: Serial

Поиск
Список
Период
Сортировка
От Milen A. Radev
Тема Re: Serial
Дата
Msg-id eut97i$n5f$1@sea.gmane.org
обсуждение исходный текст
Ответ на Re: Serial  ("Shavonne Marietta Wijesinghe" <shavonne.marietta@studioform.it>)
Список 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 по дате отправления:

Предыдущее
От: "Shavonne Marietta Wijesinghe"
Дата:
Сообщение: Re: Serial
Следующее
От: "A. Kretschmer"
Дата:
Сообщение: Re: Serial