Re: How to create primary key - Mailing list pgsql-general

From Ron Johnson
Subject Re: How to create primary key
Date
Msg-id 47305AFF.7010908@cox.net
Whole thread Raw
In response to Re: How to create primary key  (Richard Huxton <dev@archonet.com>)
List pgsql-general
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 11/06/07 03:15, Richard Huxton wrote:
> Reg Me Please wrote:
>> Hi all.
>>
>> What'd be the syntax to create a primary key on an already build table?
>
> Hmm - so you want to sort of alter a table and add a primary key
> constraint to an existing column?

While I understand your feelings, I must disagree.

That's because adding a secondary index does not have the same sort
of syntax:
ALTER TABLE foo ADD INDEX (some, existing, columns);

> ALTER TABLE my_table ADD PRIMARY CONSTRAINT (existing_column);
>
> All in the manuals:
> http://www.postgresql.org/docs/8.2/static/sql-altertable.html
>


- --
Ron Johnson, Jr.
Jefferson LA  USA

Give a man a fish, and he eats for a day.
Hit him with a fish, and he goes away for good!

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)

iD8DBQFHMFr/S9HxQb37XmcRAuqfAKCzmYeBU4dVXorvQxBUYIoQuw9YcgCeOve1
NUtFo4N/sC4julpZmMvLN0s=
=qcCO
-----END PGP SIGNATURE-----

pgsql-general by date:

Previous
From: "Albe Laurenz"
Date:
Subject: Re: How to create primary key
Next
From: "Hristo Filipov"
Date:
Subject: Re: How to transfer from place to plase without backup/restore