Re: How to auto create a unique key for each newly added record?

From: Zak McGregor <zak(at)mighty(dot)co(dot)za>
To: "Jeff" <jklcom(at)mindspring(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: How to auto create a unique key for each newly added record?
Date: 2001-03-27 03:36:14
Message-ID: 200103270336.FAA03305@zak.home.dom
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Mon, 26 Mar 2001 21:20:13 -0500
"Jeff" <jklcom(at)mindspring(dot)com> wrote:

> Hi,
>
> How to if it is possible to let postgresql to auto assign unique key to each
> new record that is added to the database?
>
Just set up the table with the field you are wanting to have as a unique id as type "serial".

eg:

create table auto_id (id serial, description varchar(32));

Cheers

Zak

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Zak McGregor 2001-03-27 03:37:33 Re: How to copy a table?
Previous Message Stephen Davies 2001-03-27 03:33:53 records zapped to null