Re: Changing data type must recreate all views?

Поиск
Список
Период
Сортировка
Искать
От
Christoph Haller
Тема
Re: Changing data type must recreate all views?
Дата
Msg-id
3F3BA82A.96D2F310@rodos.fzk.de
Список
>
> I need to change column data type from integer to float8
> That mean to droping table and recreate a new one and can lost the
original
> object id.
> Do i need to recreate all views and triggers that relate to that
table?
> if that so, is there anyway to do that without touching views and
triggers?
>
No, you don't have to drop and re-create.
How about
ALTER TABLE yourTable ADD COLUMN yourNewColumn double precision ;
UPDATE yourTable SET yourNewColumn = yourOldColumn ;
ALTER TABLE yourTable DROP COLUMN yourOldColumn ;
ALTER TABLE yourTable RENAME COLUMN yourNewColumn TO yourOldColumn ;

Views and triggers should work AFAIK, but if there are procedures
referencing the data type
of yourOldColumn, you have to re-create them changing the parameter type
from
integer to double precision.

Regards, Christoph




В списке pgsql-sql по дате отправления
От: Bruno Wolff III
Дата:
От: Jan Wieck
Дата:
FAQ