Thread: Re: Add primary and unique keys

Re: Add primary and unique keys

From
Joel Burton
Date:
On Mon, 18 Jun 2001, Riaan van Jaarsveld wrote:

> I have read your article at
> http://techdocs.postgresql.org/techdocs/updatingcolumns.php and I also read
> that PostgreSQL does not support the "add column PRIMARY KEY UNIQUE"
> statement.
>
> I then used this function to create the unique key in a column "CREATE
> UNIQUE INDEX pers_pkey ON pers ( id );"
> but how does one then create the primary key for an existing field?

AFAIK, a primary key in PG is just a unique index that
is named tablename_pkey.

--
Joel Burton   <jburton@scw.org>
Director of Information Systems, Support Center of Washington