Re: [INTERFACES] How do I drop a column from a table?

From: Robert Carbonari <robertC(at)opmr(dot)com>
To: pgsql-interfaces(at)postgresql(dot)org
Subject: Re: [INTERFACES] How do I drop a column from a table?
Date: 1999-08-31 14:34:47
Message-ID: 91E49E736688D21185F500A0C985C705156D9D@DOOM
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-interfaces

> Hi,
>
> I'm still quite new at this but it should be a simple operation: How do I
> drop a column form a Postgres table. The next best thing would be knowing
> how to change a column so that it can accept null values.
>
> Any takers?
Hi Robert,

I don't know how to email all in elm, so if you could forward this to the
list
for verification I would appreciate.

Anyway, I don't think you can drop a column. What you can do is create a
new table by doing a select into the new table (leaving out the columns you
don't want) and then droping the old table. Once the old table is dropped
you can rename the new to the old one's name:

select f1,f2...,fn into table newtable from oldtable;
drop table oldtable;
alter table newtable rename to oldtable;

Hope this helps...james

> ************
>

Robert Carbonari
Programmer
Optimal Robotics Corp.
e-mail: robertc(at)optimal-robotics(dot)com
phone: (514)738-8885 ext. 146

Browse pgsql-interfaces by date

  From Date Subject
Next Message Rusty Brooks 1999-08-31 14:39:44 Re: [INTERFACES] How do I drop a column from a table?
Previous Message Rusty Brooks 1999-08-31 14:25:24 Re: [INTERFACES] ODBC Questions