RE: delete columns from table!

Поиск
Список
Период
Сортировка
От Kevin J. Drewiske
Тема RE: delete columns from table!
Дата
Msg-id 01C12451.6746F920.drewiskk@msoe.edu
обсуждение исходный текст
Список pgsql-general
Another method is to create a new table with only the desired fields with
the SELECT INTO query

i.e. SELECT <desired query> INTO TABLE <new table> FROM <old table>

then, after deleting the old table, you will need to rename the new,
temporary table, to that of your old table.  Your conditions will need to
be reset with the new table, as it will only contain data.

Hope that help

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Kevin Drewiske '01 CE
MSOE Webmaster Team: http://www.msoe.edu/
KJDesign Website Development: http://www.drewiske.com/KJDesign/
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


-----Original Message-----
From:    Patrick Welche [SMTP:prlw1@newn.cam.ac.uk]
Sent:    Monday, August 13, 2001 09:37
To:    Fariba Noorbakhsh
Cc:    pgsql-general@postgresql.org
Subject:    Re: delete columns from table!

On Mon, Aug 06, 2001 at 05:42:09PM +0200, Fariba Noorbakhsh wrote:
> Hi Patrick,
>
> Do you know how I can drop(delete) a column from a table?! Just a column.
I don't
> think you can do it with Alter table
>
> Thanks in advance,
> Fariba

According to the TODO list:

COMMANDS
...
* ALTER
...
    o Add ALTER TABLE DROP COLUMN feature [drop]


so the way forward may be to
pg_dump -t your_table -D your_database > table.txt
and have fun editing out all reference to said column from table.txt. Then
drop the table and reload from table.txt. YMMV..

Cheers,

Patrick

----------------------------------------------------
NetZero Platinum
Sign Up Today - Only $9.95 per month!
http://my.netzero.net/s/signup?r=platinum&refcd=PT97

В списке pgsql-general по дате отправления:

Предыдущее
От: missive@frontiernet.net (Lee Harr)
Дата:
Сообщение: Re: spool
Следующее
От: "Scott Gilbert"
Дата:
Сообщение: Case sensitivity