Обсуждение: Changing the type of a column ?

Поиск
Список
Период
Сортировка

Changing the type of a column ?

От
Bayet Richard
Дата:
Is it possible to directly change the type of a column (eg: from int4 to
date) or does one have to first add a column of the desired type, copy
the first column's content, then drop this first column ?

Re: Changing the type of a column ?

От
Grant
Дата:
> Is it possible to directly change the type of a column (eg: from int4 to
> date) or does one have to first add a column of the desired type, copy
> the first column's content, then drop this first column ?

No it's not possible. Your solution is correct.


Re: Changing the type of a column ?

От
Richard Bayet
Дата:
Thanks, I finally found that ALTER TABLE didn't permit any kind of type
change...

Grant a écrit :

> > Is it possible to directly change the type of a column (eg: from int4 to
> > date) or does one have to first add a column of the desired type, copy
> > the first column's content, then drop this first column ?
>
> No it's not possible. Your solution is correct.