Re: delete column
| От | Mathieu Arnold |
|---|---|
| Тема | Re: delete column |
| Дата | |
| Msg-id | 10439662.1019909411@tot.in.t-online.fr обсуждение исходный текст |
| Ответ на | Re: delete column ("Hillensbeck, Preston" <PHillensbeck@sfbcic.com>) |
| Список | pgsql-general |
--On vendredi 26 avril 2002 15:49 -0500 "Hillensbeck, Preston" <PHillensbeck@sfbcic.com> 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 по дате отправления: