Re: Recreating unique index for primary key
Tod McQuillin <devin@spamcop.net>
From: Tod McQuillin <devin@spamcop.net>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Ryan Ho <ryanho@pacific.net.sg>, <pgsql-general@postgresql.org>
Date: 2001-09-29T15:26:07Z
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