Re: Recreating unique index for primary key

From: Tod McQuillin <devin(at)spamcop(dot)net>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Ryan Ho <ryanho(at)pacific(dot)net(dot)sg>, <pgsql-general(at)postgresql(dot)org>
Subject: Re: Recreating unique index for primary key
Date: 2001-09-29 15:26:07
Message-ID: 20010930002004.C11516-100000@glass.pun-pun.prv
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Sat, 29 Sep 2001, Tom Lane wrote:

> CREATE UNIQUE INDEX is fine as far as the database goes. Offhand it
> looks like the only extra thing a primary-key marker does is to define
> the default reference column for subsequent foreign-key references
> pointing at your table.
>
> If you want, you can reach into pg_index and set the indisprimary field
> after creating the index:

I stand corrected; there *is* something in the index itself which marks it
primary.

I'd guess that since the only time 'REFERENCES' is seen is when creating a
new table (and translated into hard-coded triggers after that), you should
be fine until you create a new table referencing the table whose primary
index you removed.

It's an inconsistency I would not feel comfortable with, so I'm glad I
learned about indisprimary. Is this documented anywhere?
--
Tod McQuillin

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tod McQuillin 2001-09-29 15:29:02 Re: Recreating unique index for primary key
Previous Message Tom Lane 2001-09-29 14:48:30 Re: Encoding passwords