Re: Adding another primary key to a populated table

From: Daniel Kunkel <DanielKunkel(at)BioWaves(dot)com>
To: Stephan Szabo <sszabo(at)megazone(dot)bigpanda(dot)com>
Cc: andrew(at)supernews(dot)com, pgsql-general(at)postgresql(dot)org
Subject: Re: Adding another primary key to a populated table
Date: 2006-01-06 15:59:06
Message-ID: 1136563146.3321.150.camel@A64
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi

Thank you for taking time to give that a try.

I'm currently running 7.3.10.

On Fri, 2006-01-06 at 07:50 -0800, Stephan Szabo wrote:
> On Thu, 5 Jan 2006, Daniel Kunkel wrote:
>
> > It makes sense that I can't have more than 1 primary key.
> >
> > Postgres was trying to create another primary key instead of modify the
> > existing primary key.
> >
> > So...
> >
> > As I understand it, a table does not always have to have a primary key
> > defined.
> >
> > Would it work to first delete/drop the primary key, then recreate the
> > primary key on all 6 columns.
> >
> > ALTER TABLE product_price DROP CONSTRAINT product_price_pkey;
> >
> > I tried this, but it doesn't seem to work... If I look at the table
> > from pgAdmin, it is still there, reindexable, I can't add a new primary
> > key, etc. But if I try to run the above command twice, it says it's
> > already been removed.
>
> What version are you using? The above sort of thing seems to work for me
> on my 8.2 devel machine (in a small test, including recreating the key)
> and I had thought it should on 8.1 as well.
>
> ---------------------------(end of broadcast)---------------------------
> TIP 2: Don't 'kill -9' the postmaster
--
Daniel

*-.,,.-*"*-.,,.-*"*-.,,.-*"*-.,,.-*"*-.,,.-*"*-.,,.-*"*-.,,.-*"*-
Have a GREAT Day!

Daniel Kunkel DanielKunkel(at)BioWaves(dot)com
BioWaves, LLC http://www.BioWaves.com
14150 NE 20th St. Suite F1
Bellevue, WA 98007
800-734-3588 425-895-0050
http://www.WizCity.com http://www.Illusion-Optical.com
*-.,,.-*"*-.,,.-*"*-.,,.-*"*-.,,.-*"*-.,,.-*"*-.,,.-*"*-.,,.-*"*-

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Berend Tober 2006-01-06 16:00:30 Re: Reordering columns in a table
Previous Message Joshua D. Drake 2006-01-06 15:55:36 Re: Reordering columns in a table