Re: Auto increment

From: Nabil Sayegh <postgresql(at)e-trolley(dot)de>
To: "Fontenot, Paul" <Paul(dot)Fontenot(at)bannerhealth(dot)com>
Cc: pgsql-novice <pgsql-novice(at)postgresql(dot)org>
Subject: Re: Auto increment
Date: 2003-05-27 18:17:27
Message-ID: 1054059447.6563.43.camel@billy
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Am Die, 2003-05-27 um 19.37 schrieb Fontenot, Paul:
> When creating a table how do you make an auto incrementing field? I'm
> using:
>
> Create table hosts (
> id int not null unique primary key,
> ip char(16),
> hostname text
> );
>
> Is there a way to make the host.id field automagicaly increment?

id SERIAL PRIMARY KEY

will be translated into int with auto value automatically

P.S.: Primary Keys are automatically not null

HTH
--
e-Trolley Sayegh & John, Nabil Sayegh
Tel.: 0700 etrolley /// 0700 38765539
Fax.: +49 69 8299381-8
PGP : www.e-trolley.de

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Adam Witney 2003-05-27 18:18:26 Re: Auto increment
Previous Message Rory Campbell-Lange 2003-05-27 17:51:51 Transaction in function problem