Re: How to create primary key

From: Ron Johnson <ron(dot)l(dot)johnson(at)cox(dot)net>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: How to create primary key
Date: 2007-11-06 12:15:59
Message-ID: 47305AFF.7010908@cox.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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-----

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Hristo Filipov 2007-11-06 12:27:10 Re: How to transfer from place to plase without backup/restore
Previous Message Albe Laurenz 2007-11-06 12:07:49 Re: How to create primary key