Recreating a primary key - Mailing list pgsql-general

From Ericson Smith
Subject Recreating a primary key
Date
Msg-id 1046450874.19793.36.camel@localhost.localdomain
Whole thread Raw
Responses Re: Recreating a primary key  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: Recreating a primary key  (Dmitry Tkach <dmitry@openratings.com>)
Re: Recreating a primary key  ("scott.marlowe" <scott.marlowe@ihs.com>)
List pgsql-general
Hi,

Is there a way to re-create a primary key?

So I create tables with CREATE TABLE... PRIMARY KEY(col...) syntax.

I later want to drop the primary key and re-create it (performance
considerations, and to not worry about exclusive table locking with a
rebuild index).

The documentation says that primary keys are basically UNIQUE and NOT
NULL keys, but checking with pg_index, I see the "indisprimary" column
is set to true.

Any quick and dirty way to rebuild these indices?


--
Ericson Smith <eric@did-it.com>


pgsql-general by date:

Previous
From: Greg Stark
Date:
Subject: Re: index usage (and foreign keys/triggers)
Next
From: Jean-Christian Imbeault
Date:
Subject: Re: Locking rows