Re: Recreating a primary key

From: "scott(dot)marlowe" <scott(dot)marlowe(at)ihs(dot)com>
To: Ericson Smith <eric(at)did-it(dot)com>
Cc: Postgresql General <pgsql-general(at)postgresql(dot)org>
Subject: Re: Recreating a primary key
Date: 2003-02-28 20:33:53
Message-ID: Pine.LNX.4.33.0302281332300.22448-100000@css120.ihs.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 28 Feb 2003, Ericson Smith wrote:

> 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?

Have you tried reindex? It does basically just that. And I've just
tested to be sure, it does work on pkey indexes just fine.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Dave Cramer 2003-02-28 20:44:52 Re: phpBB2 slow on postgres vs mysql ?
Previous Message scott.marlowe 2003-02-28 20:30:26 Re: Locking rows