Re: Changing the Primary Key Column

From: Darrell Fuhriman <darrell(at)garnix(dot)org>
To: Rich Shepard <rshepard(at)appl-ecosys(dot)com>
Cc: pdxpug(at)postgresql(dot)org
Subject: Re: Changing the Primary Key Column
Date: 2011-02-24 00:26:10
Message-ID: 673012AA-F000-4D4E-8515-7C2118984CDE@garnix.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pdxpug

Why make it so hard?

begin;
SELECT * INTO new_table FROM old_table;
DROP old_table;
CREATE old_table ( new definition );
INSERT INTO old_table SELECT col1,col2,col3,etc. FROM new_table;
DROP new_table;
commit;

On Feb 23, 2011, at 16:22, Rich Shepard wrote:

> On Wed, 23 Feb 2011, Michael Ewan wrote:
>
>> 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.
>
> I read the pg_dump man page but did not learn how to specify an
> alternative format that would allow me to re-arrange column order, drop the
> unwanted column, and so on. Next step is looking at the 9.0.x docs for
> pg_dump.
>
> Rich
>
> --
> Sent via pdxpug mailing list (pdxpug(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pdxpug

In response to

Responses

Browse pdxpug by date

  From Date Subject
Next Message Joshua D. Drake 2011-02-24 00:28:01 Re: Changing the Primary Key Column
Previous Message Rich Shepard 2011-02-24 00:22:11 Re: Changing the Primary Key Column