X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 126E39DCA22 for ; Thu, 23 Feb 2006 21:51:52 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 13966-05 for ; Thu, 23 Feb 2006 21:51:54 -0400 (AST) X-Greylist: delayed 00:06:38.815395 by SQLgrey- Received: from smtp109.sbc.mail.mud.yahoo.com (smtp109.sbc.mail.mud.yahoo.com [68.142.198.208]) by postgresql.org (Postfix) with SMTP id A9BB99DC9E3 for ; Thu, 23 Feb 2006 21:51:48 -0400 (AST) Received: (qmail 6160 invoked from network); 24 Feb 2006 01:45:13 -0000 Received: from unknown (HELO DMJVGEN) (franklin.rice@sbcglobal.net@64.165.39.190 with login) by smtp109.sbc.mail.mud.yahoo.com with SMTP; 24 Feb 2006 01:45:12 -0000 From: "Daniel Joo" To: Subject: how to add primary key to existing table with multiple primary keys Date: Thu, 23 Feb 2006 17:45:03 -0800 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_0000_01C638A0.E0E1E020" X-Mailer: Microsoft Office Outlook, Build 11.0.6353 Thread-Index: AcY448Z/2//8OVVaRkekT7CMEVCfpw== X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 Message-Id: <20060224015148.A9BB99DC9E3@postgresql.org> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.928 required=5 tests=[HTML_MESSAGE=0.001, MSGID_FROM_MTA_ID=0.927] X-Spam-Score: 0.928 X-Spam-Level: X-Archive-Number: 200602/331 X-Sequence-Number: 24341 This is a multi-part message in MIME format. ------=_NextPart_000_0000_01C638A0.E0E1E020 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit 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! ------=_NextPart_000_0000_01C638A0.E0E1E020 Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable

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           &nb= sp;       | 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! 

------=_NextPart_000_0000_01C638A0.E0E1E020--