From: | Michael Ewan <michael(dot)ewan(at)intel(dot)com> |
---|---|
To: | pdxpug(at)postgresql(dot)org |
Subject: | Re: Changing the Primary Key Column |
Date: | 2011-02-24 00:16:34 |
Message-ID: | 4D65A362.6070800@intel.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pdxpug |
On 02/23/2011 04:12 PM, Rich Shepard wrote:
> On Wed, 23 Feb 2011, Michael Ewan wrote:
>
>> Maybe someone else has a better answer but in my experience you have to
>> drop the table to change the PK. You can add/drop other indexes or FK.
>> How about leaving the synthetic PK and adding an extra index for your
>> other key. Doing that also gets you away from any duplicate primary key
>> errors. Although Josh Berkus will probably slap me silly for ever
>> suggesting a synthetic key.
>
> Michael,
>
> Joe Celko doesn't like synthetic keys, either.
>
> I suppose what I need to do is dump the table to a .sql file and make
> changes there. If I drop the table I lose all the hours of work getting data
> in there. :-(
Yes that would be a good idea, and was implied in any suggestion of
dropping tables. ;-)
Just be advised, pg_dump dumps to a copy from stdin: format with tab
delimiters.
From | Date | Subject | |
---|---|---|---|
Next Message | Tim Bruce | 2011-02-24 00:21:21 | Re: Changing the Primary Key Column |
Previous Message | Rich Shepard | 2011-02-24 00:12:12 | Re: Changing the Primary Key Column |