Re: Newbie Question

From: Ludwig Meyerhoff <ludwig(at)antar(dot)com>
To: Clay & Judi Kinney <cricketk(at)home(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Newbie Question
Date: 2001-05-04 20:53:11
Message-ID: Pine.LNX.4.21.0105042250020.4404-100000@ludwig
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hallo!

> How do I create an autoincrement field in a postgresql table???
> What are the correct field type and parameters????
Well, what about using sequences?
create sequence tralalala;
create table huibui
(
id integer primary key default nextval('tralalala'),
field1 references table1,
and-so-on references all-other-tables
);

How, each time You insert some data in huibui using
insert into huibui (field1, and-son-on) values (?, ..);
the 'tralala' counter will be increased by one (nextval).

Saluti!

Ludwig

In response to

Browse pgsql-general by date

  From Date Subject
Next Message John Coers 2001-05-04 21:07:09 Re: commit_delay CANCEL
Previous Message Bruce Momjian 2001-05-04 20:47:52 Re: Re: Metaphone function attachmenty