Re: Auto incrementing an integer

From: Thomas Swan <tswan(at)olemiss(dot)edu>
To: Sylte <Sylte_(at)hotmail(dot)com>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: Auto incrementing an integer
Date: 2001-05-14 21:27:34
Message-ID: 3B004DC6.70301@olemiss.edu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Sylte wrote:

>How do I construct a datatype that autoincrement in postgreSQL?
>
Use the SERIAL data type instead of an INT4. Serial is an integer
(INT4) that's default value is base on a sequence.

for example...

create table foo (
my_id serial not null,
my_data text
);

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Philip Hallstrom 2001-05-14 21:53:38 Re: Auto incrementing an integer
Previous Message Peter Eisentraut 2001-05-14 20:39:21 Re: Case