On Sat, 2005-08-27 at 06:34 +0900, francois wrote: > Declare the id column as an serial. > > id serial not null Wait, don't forget the PRIMARY KEY! not null is automatically done.. > foo=# CREATE TABLE recipes ( > foot(# id SERIAL PRIMARY KEY, > foo(# name VARCHAR(255), > foo(# created_at TIMESTAMP > foo(# ); > NOTICE: CREATE TABLE will create implicit sequence "recipes_id_seq" for serial column "recipes.id" > NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "recipes_pkey" for table "recipes" > CREATE TABLE > foo=# \d recipes > Table "public.recipes" > Column | Type | Modifiers > ------------+-----------------------------+--------------------------------------------------------- > id | integer | not null default nextval('public.recipes_id_seq'::text) > name | character varying(255) | > created_at | timestamp without time zone | > Indexes: > "recipes_pkey" primary key, btree (id) -- /****************************************************** * Robby Russell, Owner.Developer.Geek * PLANET ARGON, Open Source Solutions & Web Hosting * Portland, Oregon | p: 503.351.4730 | f: 815.642.4068 * www.planetargon.com | www.robbyonrails.com *******************************************************/