pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Stephan Szabo <sszabo@megazone.bigpanda.com>
To: Daniel Joo <djoo@vistagen-inc.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: how to add primary key to existing table with multiple
Date: Tue, 28 Feb 2006 18:53:53 -0800 (PST)
Message-ID: <20060228185121.O86334@megazone.bigpanda.com> (raw)
In-Reply-To: <20060224015148.A9BB99DC9E3@postgresql.org>
References: <20060224015148.A9BB99DC9E3@postgresql.org>

On Thu, 23 Feb 2006, Daniel Joo wrote:

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

You only can have one primary key.  The table you gave has a single
primary key with two columns.  Are you trying to guarantee that expid
along is unique or that the set (probeid, tissueid, expid) is unique?

You can make expid UNIQUE and NOT NULL for the first case which is similar
to a primary key (although it's not a default foreign key target).  In the
second you can drop the current constraint and add one on the three
columns.

> Indexes:
>
>     "extprobe2tissue_pkey" PRIMARY KEY, btree (probeid, tissueid)
>     "extprobe2tissue_probeid" btree (probeid)
>     "extprobe2tissue_tissueid" btree (tissueid)



view thread (3+ messages)  latest in thread

Message-ID: <20060228185121.O86334@megazone.bigpanda.com>
Permalink:  ../20060228185121.O86334@megazone.bigpanda.com/
Also on:    postgresql.org/message-id/20060228185121.O86334@megazone.bigpanda.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: sszabo@megazone.bigpanda.com, djoo@vistagen-inc.com
  Subject: Re: how to add primary key to existing table with multiple
  In-Reply-To: <20060228185121.O86334@megazone.bigpanda.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox