Re: Newbie Question - Mailing list pgsql-general

From Ludwig Meyerhoff
Subject Re: Newbie Question
Date
Msg-id Pine.LNX.4.21.0105042250020.4404-100000@ludwig
Whole thread Raw
In response to Newbie Question  ("Clay & Judi Kinney" <cricketk@home.com>)
List 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


pgsql-general by date:

Previous
From: Lark
Date:
Subject: Data type money. How to use?
Next
From: Justin Clift
Date:
Subject: When DST occurs