From: | The Web Administrator <wwwadmin(at)wizard(dot)ca> |
---|---|
To: | PGsql <pgsql-sql(at)postgreSQL(dot)org> |
Subject: | How to handle a requirement for nextval |
Date: | 1998-05-18 20:33:19 |
Message-ID: | 35609B0F.52A63C2@wizard.ca |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
I am still struggling on a few issues, have got my first little database
up and running, and am quite happy with PostGres, but I cannot figure
out how to create a table which can have a field that autoincrements..
I am sure that somewhere in the oid terminology it is built in, but I
want to have a counter on some table entries.. ie...
CREATE TABLE clothing_type (
type_id INT NOT NULL,
description TEXT,
for_sex CHAR
);
INSERT INTO clothing_type (
description,
for_sex
) VALUES (
'pants',
'm'
);
What I want is that the Primary Key (Only Key) be type_id, and int, and
the first item that I insert should have type_id as '1', next will be
'2' etc..
I could have every insert into this table include a type_id, but that
seems unessary.
Can I have something like default='nextval' ?
From | Date | Subject | |
---|---|---|---|
Next Message | Mike Lemler | 1998-05-18 21:04:01 | Case in-sensitive searches |
Previous Message | Marin D | 1998-05-18 17:19:18 | Re: [GENERAL] Postgres Database Grows |