Hoow do you drop a column in a table

Started by Art Foreabout 21 years ago4 messagesgeneral
Jump to latest
#1Art Fore
art.fore@comcast.net

Using phppgadmin, I tried tropping a column in a table. I comes back to
try DROP .. CASCADE. Went into psql and typed the following,

ALTER TABLE "MPC" DROP COLUMNG do_not_use CASCADE

It appeared to work but did not drop the column. What is the dprocedure
for dropping a column? an anyone point me to a document that tells
EXACTLY how to do this? Also, how do you find out the dependencies it
says it has? I know of none.

Art

#2John DeSoi
desoi@pgedit.com
In reply to: Art Fore (#1)
Re: Hoow do you drop a column in a table

Hi Art,

On Feb 8, 2005, at 7:37 PM, Art Fore wrote:

ALTER TABLE "MPC" DROP COLUMNG do_not_use CASCADE

It appeared to work but did not drop the column. What is the
dprocedure for dropping a column? an anyone point me to a document
that tells EXACTLY how to do this? Also, how do you find out the
dependencies it says it has? I know of none.

Here is the documentation:

http://www.postgresql.org/docs/8.0/interactive/sql-altertable.html

If it still does not work, try again in psql and then paste the output
in your email so we can better understand the problem.

John DeSoi, Ph.D.
http://pgedit.com/
Power Tools for PostgreSQL

#3Robby Russell
robby@planetargon.com
In reply to: Art Fore (#1)
Re: Hoow do you drop a column in a table

On Tue, 2005-02-08 at 16:37 -0800, Art Fore wrote:

Using phppgadmin, I tried tropping a column in a table. I comes back to
try DROP .. CASCADE. Went into psql and typed the following,

ALTER TABLE "MPC" DROP COLUMNG do_not_use CASCADE

It appeared to work but did not drop the column. What is the dprocedure
for dropping a column? an anyone point me to a document that tells
EXACTLY how to do this? Also, how do you find out the dependencies it
says it has? I know of none.

Art

ALTER TABLE foo DROP COLUMN name CASCADE;

--
/***************************************
* Robby Russell | Owner.Developer.Geek
* PLANET ARGON | www.planetargon.com
* Portland, OR | robby@planetargon.com
* 503.351.4730 | blog.planetargon.com
* PHP/PostgreSQL Hosting & Development
* --- Now hosting Ruby on Rails Apps ---
****************************************/

#4Art Fore
art.fore@comcast.net
In reply to: Robby Russell (#3)
Re: Hoow do you drop a column in a table

Thanks for the answers. I recreated the views. Did not realize when you
renamed a column, it also changed the views.

Art

Robby Russell wrote:

Show quoted text

On Tue, 2005-02-08 at 16:37 -0800, Art Fore wrote:

Using phppgadmin, I tried tropping a column in a table. I comes back to
try DROP .. CASCADE. Went into psql and typed the following,

ALTER TABLE "MPC" DROP COLUMNG do_not_use CASCADE

It appeared to work but did not drop the column. What is the dprocedure
for dropping a column? an anyone point me to a document that tells
EXACTLY how to do this? Also, how do you find out the dependencies it
says it has? I know of none.

Art

ALTER TABLE foo DROP COLUMN name CASCADE;