Re: drop column?

Поиск
Список
Период
Сортировка
От bangh
Тема Re: drop column?
Дата
Msg-id 3C4F2071.74B3EC51@baileylink.net
обсуждение исходный текст
Ответ на drop column?  (Jodi Kanter <jkanter@virginia.edu>)
Список pgsql-admin
Probably not, but I don't the new version.

There are some ways you can do for this prupose.

Create a new table in that database without that columns. you can do this very easily:

1. pg_dump -t table_name -s your_dbname > anyname.dump
   the switch -s means without data, schem only. it is a very simple ascii file and readable

2. using some edit tool to open file anyname.dump and remove the columns you don't want and change the table name as a new one like "table_new" and do:

3. cat anyname.dump | psql your_dbname

4. psql your_db_name
psql> insert into table_new select field1, field2, ... from ori_table;
psql> drop ori_table;
psql> alter table rename table_new ori_table;

Then it is done.

PS. for safe, dump your entire database first

Banghe

Jodi Kanter wrote:

I cannot seem to locate any documentation about removing a column that I just added to a table. There is no data in that particular column but there is in the rest of the table.Can I remove this column or will I need to drop the entire table and restore from backup?ThanksJodi
_______________________________


Jodi L Kanter
BioInformatics Database Administrator
University of Virginia
(434) 924-2846
jkanter@virginia.edu

<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

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

Предыдущее
От: "Nick Fankhauser"
Дата:
Сообщение: Re: drop column?
Следующее
От: "Zhang, Anna"
Дата:
Сообщение: timing a process