Re: delete column

From: wsheldah(at)lexmark(dot)com
To: webmaster <webmaster(at)harbornet(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: delete column
Date: 2002-04-26 20:54:25
Message-ID: 200204262054.QAA17147@interlock2.lexmark.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

1. Back up your database.
2. Use pg_dump to save the schema and data for that table to a text file
3. Edit the file to add a DROP TABLE statement before the CREATE TABLE
statement,
and edit the CREATE TABLE statement to omit the column you want to drop.
4. Make sure your data is in the file and is intact.
5. Use psql to execute the commands in the file you just edited.

You'll also want to take steps to be sure no one attempts to update the table
between the time you dump it and the time it finishes restoring.

You may also want to take a look at the TODO list on the postgresql website and
estimate how long it may be before support for DROP COLUMN is added, and support
for ALTER COLUMN improves. Personally, I haven't had a problem with this
procedure, but my dataset is relatively small and I've incurred very little
downtime the few times I've had to do this.

Wes Sheldahl

webmaster <webmaster%harbornet(dot)com(at)interlock(dot)lexmark(dot)com> on 04/26/2002 08:50:53
AM

To: pgsql-general%postgresql(dot)org(at)interlock(dot)lexmark(dot)com
cc: (bcc: Wesley Sheldahl/Lex/Lexmark)
Subject: [GENERAL] delete column

I know this is an easy question, but I can't find any info on how do
this in the PostgreSQL book. How do you delete a column? I've been
able to delete tables, db's, rows, etc. But can't figure out how to
just delete a column. I'm running RedHat 7.2 and PostgreSQL 7.1

Thanks for any help.

---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to majordomo(at)postgresql(dot)org

Browse pgsql-general by date

  From Date Subject
Next Message Bruce Momjian 2002-04-26 20:58:02 Re: delete column
Previous Message Hillensbeck, Preston 2002-04-26 20:49:49 Re: delete column