Re: Recreating unique index for primary key

From: Tod McQuillin <devin(at)spamcop(dot)net>
To: Ryan Ho <ryanho(at)pacific(dot)net(dot)sg>
Cc: <pgsql-general(at)postgresql(dot)org>
Subject: Re: Recreating unique index for primary key
Date: 2001-09-29 08:07:49
Message-ID: 20010929170228.Y11516-100000@glass.pun-pun.prv
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Fri, 28 Sep 2001, Ryan Ho wrote:

> I've dropped an primary key index in order to re-create it. but i realized
> that i can't recreate a primary key index. Will a unique index be an adequate
> replacement? will the database integrity be at risk as a result?

I think that 'PRIMARY KEY' in a table definition is just shorthand for
'UNIQUE NOT NULL', in addition to whatever magic is required to mark the
column as primary so that 'REFERENCES' constraints in other tables know
which column to default to.

If all you did was delete the index and recreate it, you should be fine --
as far as I know there is nothing in the index itself marking it as
"primary".
--
Tod McQuillin

P.S. If I am wrong or incomplete in my speculations above, I am sure
someone will jump in and correct me, which is exactly what I'm hoping for.
The best way to get correct answers on a mailing list is to post wrong
answers :-)

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Martijn van Oosterhout 2001-09-29 08:30:13 Re: Performance question (stripped down the problem)
Previous Message lt 2001-09-29 07:59:25 Copy error?