Re: [SQL] Converting an existing table?

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: [SQL] Converting an existing table?
Дата
Msg-id 13298.937664612@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Converting an existing table?  ("Zot O'Connor" <zot@zotconsulting.com>)
Список pgsql-sql
"Zot O'Connor" <zot@zotconsulting.com> writes:
> I need to change the type on an existing table.  From money to something
> else.
> What is the best way under postgres?

Probably the best way at the moment is:

1. Create new table with the desired column declarations, using a
different table name.

2. Use INSERT ... SELECT ... to copy the data from old table to new,
with any transformations needed.

3. When you are happy with the contents of the new table, drop the
old table and ALTER TABLE RENAME to rename the new table to the
original table name.
        regards, tom lane


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

Предыдущее
От: sniper7107@yahoo.com
Дата:
Сообщение: ¸ÞÀϹ߼۱âÀÔ´Ï´Ù ½Ã°£´ç20¸¸°³¸¦ ¹ß¼ÛÇÒ¼öÀÕ½¿´Ï´Ù
Следующее
От: Molnar Laszlo
Дата:
Сообщение: [SQL] input function problem for user type array