Re: Changing data type must recreate all views?
Re: Changing data type must recreate all views?
От:
Christoph Haller <ch@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