Re: delete column

Поиск
Список
Период
Сортировка
Искать
От
Mathieu Arnold
Тема
Re: delete column
Дата
Msg-id
10439662.1019909411@tot.in.t-online.fr
Ответ на
Re: delete column (Hillensbeck, Preston)
Список
Дерево обсуждения
Re: delete column "Ian Harding" <ianh@tpchd.org>


--On vendredi 26 avril 2002 15:49 -0500 "Hillensbeck, Preston" 
 wrote:

> 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 :)

this is not really good, as you loose all defaults from the table.
I believe that
CREATE TABLE new_table (fields without the one you want);
INSERT INTO new_table SELECT ... FROM old_table;
DROP TABLE old_table;
ALTER TABLE new_table RENAME to old_table;


-- 
Mathieu Arnold
В списке pgsql-general по дате отправления
От: Lincoln Yeoh
Дата:
От: Francois Suter
Дата:
FAQ