how to add primary key to existing table with multiple primary keys

From: "Daniel Joo" <djoo(at)vistagen-inc(dot)com>
To: <pgsql-sql(at)postgresql(dot)org>
Subject: how to add primary key to existing table with multiple primary keys
Date: 2006-02-24 01:45:03
Message-ID: 20060224015148.A9BB99DC9E3@postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Hi there,

I am trying to add another primary key to an existing table with two other
primary keys. I got the following error when I tried this command:

alter table extprobe2tissue ADD primary key (expid);

ERROR: multiple primary keys for table "extprobe2tissue" are not allowed

The details of the extprobe2tissue table is:

\d extprobe2tissue;

Table "public.extprobe2tissue"

Column | Type | Modifiers

-------------+------------------------+-----------

probeid | integer | not null

tissueid | integer | not null

value | double precision | not null

entrydate | date | not null

description | character varying(200) |

qval | double precision |

expid | integer | not null

Indexes:

"extprobe2tissue_pkey" PRIMARY KEY, btree (probeid, tissueid)

"extprobe2tissue_probeid" btree (probeid)

"extprobe2tissue_tissueid" btree (tissueid)

Foreign-key constraints:

"extprobe2tissue_tissueid_fkey" FOREIGN KEY (tissueid) REFERENCES
tissue(tissueid)

"extprobe2tissue_probeid_fkey" FOREIGN KEY (probeid) REFERENCES
extprobe(probeid)

Any suggestion would be much appreciated.

Thanks!

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Markus Schaber 2006-02-24 10:45:01 CREATE TABLE AS and tablespaces
Previous Message Owen Jacobson 2006-02-23 23:08:20 Re: Question about index scan vs seq scan when using count()