Newbie Question
How do I create an autoincrement field in a postgresql table???
What are the correct field type and parameters????
Any help would be appreciated.....
Thanks
Clay
You *really* should go glance over the manual.. There is the field type
SERIAL and things called sequences, both could be what you're talking
about....The rest I'll leave up to you :-)
Good luck!!!
-Mitch
----- Original Message -----
From: "Clay & Judi Kinney" <cricketk@home.com>
To: <pgsql-general@postgresql.org>
Sent: Tuesday, May 01, 2001 8:34 AM
Subject: Newbie Question
Show quoted text
How do I create an autoincrement field in a postgresql table???
What are the correct field type and parameters????
Any help would be appreciated.....
Thanks
Clay
---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster
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
On Tue, 1 May 2001, Clay & Judi Kinney wrote:
How do I create an autoincrement field in a postgresql table???
What are the correct field type and parameters????
Any help would be appreciated.....
CREATE TABLE foo (
id SERIAL,
...
)
it comes out as an int4 or integer type.
--
Joel Burton <jburton@scw.org>
Director of Information Systems, Support Center of Washington
Clay & Judi Kinney writes:
How do I create an autoincrement field in a postgresql table???
See FAQ.
--
Peter Eisentraut peter_e@gmx.net http://funkturm.homeip.net/~peter