From: | "Joshua D(dot) Drake" <jd(at)commandprompt(dot)com> |
---|---|
To: | Michael Ewan <michael(dot)ewan(at)intel(dot)com> |
Cc: | pdxpug(at)postgresql(dot)org |
Subject: | Re: Changing the Primary Key Column |
Date: | 2011-02-24 00:28:01 |
Message-ID: | 1298507281.14800.132.camel@jd-desktop |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pdxpug |
On Wed, 2011-02-23 at 16:06 -0800, Michael Ewan wrote:
>
> On 02/23/2011 03:34 PM, Rich Shepard wrote:
> > This, too, is new to me. The first table column is a contrived key that is
> > no longer needed as a unique row identifier. The second column should
> > replace the first as the primary key. The ALTER TABLE command can add a
> > primary key to a column, but I don't see how to remove that constraint from
> > column1, add it to column2, so I can drop column1.
> >
>
> Maybe someone else has a better answer but in my experience you have to
> drop the table to change the PK.
Uhh, no. You drop the constraint and re-add it for the second column.
JD
--
PostgreSQL.org Major Contributor
Command Prompt, Inc: http://www.commandprompt.com/ - 509.416.6579
Consulting, Training, Support, Custom Development, Engineering
http://twitter.com/cmdpromptinc | http://identi.ca/commandprompt
From | Date | Subject | |
---|---|---|---|
Next Message | Rich Shepard | 2011-02-24 00:40:21 | Re: Changing the Primary Key Column |
Previous Message | Darrell Fuhriman | 2011-02-24 00:26:10 | Re: Changing the Primary Key Column |