Try this command at the psql command line:
CREATE SEQUENCE atable_id_seq;
ALTER TABLE atable ALTER COLUMN id SET DEFAULT
nextval('"atable_id_seq"'::text);
Jeff
-Original Message-
How can I make the insert
command automatically update the 'id' to the next highest number?
---
Ahhh, but I didn't use a double quote identifier. This statement worked fine
for me:
CREATE TABLE atable (
title VARCHAR(20),
name VARCHAR(20),
id SERIAL PRIMARY KEY,
date DATE);
Greg
- Original Message -
From: "Joel Burton" <[EMAIL PROTECTED]>
To: "Gregory Wood" <[EMAIL PROTECTED]>
Cc:
On Thu, 26 Apr 2001, Gregory Wood wrote:
> > I don't know if you can name a column "date" because I think it's a
> > reserved word.
>
> Oddly enough, it *does* work (at least on my version of 7.1), although I
> would recommend against doing it if for no other reason than it's confusing.
If you
> I don't know if you can name a column "date" because I think it's a
> reserved word.
Oddly enough, it *does* work (at least on my version of 7.1), although I
would recommend against doing it if for no other reason than it's confusing.
Greg
---(end of broadcast)---
> > I'm surprised that works at all... the name of the table is "atable",
isn't
> > it? Try this:
> >
> > INSERT INTO atable (title,name,date) VALUES ('SQL3','Toy',date('now'));
> >
> > Greg
>
> Thanks for the help. I wrote the command out wrong in the post, I did try
the
> one that you wrote out