Re: [GENERAL] DELETE COLUMN function

From: Chris Bitmead <chris(dot)bitmead(at)bigfoot(dot)com>
To: pgsql-general(at)postgreSQL(dot)org
Subject: Re: [GENERAL] DELETE COLUMN function
Date: 1999-05-17 13:48:24
Message-ID: 37401E28.C560650B@bigfoot.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Justin Long wrote:
>
> Does anyone have any tips as to how I would go about:
>
> 1. deleting a column out of a database
>
> 2. changing the width of a column in the database

Either...
a) do a SELECT INTO another table and rename that table to be the
original one. You lose the old oids, which may or may not worry you.
b) Use the COPY command to dump the columns to a file. Use perl, C or
your favourite tool to remove the column. Recreate the empty table in
the database using the new schema and load back in.

Not ideal I know.

>
> I've looked at the ALTER TABLE function but all it seems to be able to do is
> to add a column and rename a column. I had thought that I could use it to
> create a new column of the width desired, copy the old column into the new,
> and delete the old, then rename the new to the old, but without a delete
> function this isn't possible...
>
> Never retreat. Never surrender. Never cut a deal with a dragon.
> _______________________________________________________________
> Justin Long CIO / Site Editor
> 616 Station Square Ct Network for Strategic Missions
> Chesapeake, VA 23320 977 Centerville Trnpk CSB 317
> JustinLong(at)xc(dot)org Va Beach, VA 23463
> Check out our site at: http://www.strategicnetwork.org

--
Chris Bitmead
http://www.bigfoot.com/~chris.bitmead
mailto:chris(dot)bitmead(at)bigfoot(dot)com

In response to

Browse pgsql-general by date

  From Date Subject
Next Message selkovjr.mcs.anl.gov 1999-05-17 16:00:00 Re: [GENERAL] Trying to make functions in 'C'
Previous Message Justin Long 1999-05-17 12:19:02 DELETE COLUMN function