Yes.. Try SERIAL datatype.
test=# Create Table test (my_auto SERIAL,Name text);
NOTICE: CREATE TABLE will create implicit sequence 'test_my_auto_seq' for
SERIAL column 'test.my_auto'
NOTICE: CREATE TABLE/UNIQUE will create implicit index 'test_my_auto_key'
for table 'test'
CREATE
test=# insert into test(name) values ('Denis');
INSERT 13170208 1
test=# select * from test;
my_auto | name
---------+-------
1 | Denis
(1 row)
Note : It implicitely creates SEQUENCE and associate it with the field. But
if you drop the table, you need to drop the SEQUENCE manually.. it does not
drop it automatically..
Denis
----- Original Message -----
From: "Jim Steil" <jim.steil@customcall.com>
To: <pgsql-novice@postgresql.org>
Sent: Saturday, July 27, 2002 1:19 AM
Subject: [NOVICE] Auto-incrementing field
> Is there a data type in PostgreSQL that will 'auto-increment'? I have
used
> this in MS SQL Server in the past and would like to continue to do so with
> PostgreSQL. Thanks for any help...
>
> -Jim
>
> Jim Steil
> CustomCall Data Systems
> (608) 274-3009
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 3: if posting/reading through Usenet, please send an appropriate
> subscribe-nomail command to majordomo@postgresql.org so that your
> message can get through to the mailing list cleanly