Re: auto increment primary key

From: Frank Joerdens <frank(at)joerdens(dot)de>
To: impala <bhnnc(at)yahoo(dot)co(dot)uk>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: auto increment primary key
Date: 2002-04-05 10:30:39
Message-ID: 20020405123039.A3241@superfly.archi-me-des.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Fri, Apr 05, 2002 at 02:21:19AM -0800, impala wrote:
> I created a table, want the integer/varchar primary
> key column to be incremented automatically when
> inserted a new row. How do I define the table to do
> that? I tried AUTO_INCREMENT and INCREMENT but
> postgres accept none of them.

create table foo (
bar serial primary key,
. . .

This implies the creation of a special table called a sequence which
does the auto-incrementing.

Regards, Frank

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Martín Marqués 2002-04-05 11:01:05 Re: binary data storage
Previous Message Marin Dimitrov 2002-04-05 10:30:19 Re: auto increment primary key