Skip site navigation (1) Skip section navigation (2)

sequence primary key

From: Virginie Garcia <Virginie(dot)Garcia(at)pmtg(dot)u-bordeaux2(dot)fr>
To: pgsql-novice(at)postgresql(dot)org
Subject: sequence primary key
Date: 2001-07-17 15:43:53
Message-ID: 01071717435300.01122@BIOINFO1.pmtg.u-bordeaux2.fr (view raw or flat)
Thread:
Lists: pgsql-novice
Hi all,

my question is about sequences and primary key of a table.
More details : I create a sequence and a table with these lines :

CREATE SEQUENCE "my_id" INCREMENT 1 MINVALUE 1 MAXVALUE 2147483647 START 1 
CACHE 1;

CREATE TABLE "toto" (
	"toto_id" integer PRIMARY KEY DEFAULT nextval('"my_id"'),
	"db" text);

in a a sql file.
In fact, when I fill database I would like "toto_id" field to be filled 
directly by sgdb by using sequence "my_id" but not by me.
This way doesn't work. It's perhaps a big mistake !!!
How is-it possible, so ?
Thanks a lot.

Virginie.

In response to

Responses

pgsql-novice by date

Next:From: Robby SlaughterDate: 2001-07-17 16:14:19
Subject: RE: COUNT doesn't shows items with 0 occurrance
Previous:From: Jiri D. HoogeveenDate: 2001-07-17 15:21:05
Subject: execute sql in a function?

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group