Re: delete column - Mailing list pgsql-general

From wsheldah@lexmark.com
Subject Re: delete column
Date
Msg-id 200204262054.QAA17147@interlock2.lexmark.com
Whole thread Raw
In response to delete column  (webmaster <webmaster@harbornet.com>)
List 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.com@interlock.lexmark.com> on 04/26/2002 08:50:53
AM

To:   pgsql-general%postgresql.org@interlock.lexmark.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@postgresql.org





pgsql-general by date:

Previous
From: "Hillensbeck, Preston"
Date:
Subject: Re: delete column
Next
From: Bruce Momjian
Date:
Subject: Re: delete column