Adding another primary key to a populated table

From: Daniel Kunkel <DanielKunkel(at)BioWaves(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Adding another primary key to a populated table
Date: 2006-01-06 04:08:39
Message-ID: 1136520519.3321.44.camel@A64
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi

I'm trying to add another primary key to a table populated with data and
a number of foreign key constraints.

The new column is populated with non-null data (a requirement as I
understand it to become a valid primary key)

I tried:

ALTER TABLE product_price
ADD CONSTRAINT product_price_pkey6 PRIMARY KEY
(product_id,product_price_type_id,currency_uom_id,product_store_group_id,from_date,product_price_purpose_id);

without having any luck.

Any suggestions?

Would it work to dump the database, edit the sql, and re-import?

Thanks in advance.

--
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
*-.,,.-*"*-.,,.-*"*-.,,.-*"*-.,,.-*"*-.,,.-*"*-.,,.-*"*-.,,.-*"*-

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Jim C. Nasby 2006-01-06 04:51:02 Re: Adding another primary key to a populated table
Previous Message Michael Fuhr 2006-01-06 03:03:21 Re: plpgsql question