Re: delete column

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: "Hillensbeck, Preston" <PHillensbeck(at)sfbcic(dot)com>
Cc: "'webmaster'" <webmaster(at)harbornet(dot)com>, "'pgsql-general(at)postgresql(dot)org'" <pgsql-general(at)postgresql(dot)org>
Subject: Re: delete column
Date: 2002-04-26 20:58:02
Message-ID: 200204262058.g3QKw2916217@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hillensbeck, Preston wrote:
> There isn't a DROP COLUMN function yet, but you can do this...
>
> SELECT ... -- select all columns but the one you want to remove
> INTO TABLE new_table
> FROM old_table;
> DROP TABLE old_table;
> ALTER TABLE new_table RENAME TO old_table;
>
> This is straight out of Bruce Momjian's book, so you can give him credit for
> this :)

This is from the FAQ, which appears in my book. I think I wrote that
too, or at least with help from others. Wish we had a cleaner way, but
right now, that is all we have.

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Ian Harding 2002-04-26 21:00:49 Re: delete column
Previous Message wsheldah 2002-04-26 20:54:25 Re: delete column