From: Milen A. Radev <milen@radev.net>
To: pgsql-sql@postgresql.org
Subject: Re: Serial
Date: Tue, 03 Apr 2007 13:10:58 +0300
Message-ID: <eut97i$n5f$1@sea.gmane.org> (raw)
In-Reply-To: <00b101c775d6$2d313840$1102a8c0@dream>
References: <008301c775d1$4b224420$1102a8c0@dream>
<20070403093222.GB30108@a-kretschmer.de>
<00b101c775d6$2d313840$1102a8c0@dream>
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: milen@radev.net
Subject: Re: Serial
In-Reply-To: <eut97i$n5f$1@sea.gmane.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox