Re: delete column

From: "Ian Harding" <ianh(at)tpchd(dot)org>
To: <webmaster(at)harbornet(dot)com>, <PHillensbeck(at)sfbcic(dot)com>
Cc: <pgsql-general(at)postgresql(dot)org>
Subject: Re: delete column
Date: 2002-04-26 21:00:49
Message-ID: scc95de7.072@mail.tpchd.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

But you lose all your RI constraints. I keep the RI constraints in a separate file so I can re-create them when I need to ...

>>> "Hillensbeck, Preston" <PHillensbeck(at)sfbcic(dot)com> 04/26/02 01:49PM >>>
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 :)

-----Original Message-----
From: webmaster [mailto:webmaster(at)harbornet(dot)com]
Sent: Friday, April 26, 2002 7:51 AM
To: pgsql-general(at)postgresql(dot)org
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

---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to majordomo(at)postgresql(dot)org so that your
message can get through to the mailing list cleanly

Browse pgsql-general by date

  From Date Subject
Next Message Scott Marlowe 2002-04-26 22:18:22 Re: intel vs amd benchmark for pg server
Previous Message Bruce Momjian 2002-04-26 20:58:02 Re: delete column