Re: alter table question

Поиск
Список
Период
Сортировка
От Gregory Wood
Тема Re: alter table question
Дата
Msg-id 012e01c1c378$5c61f520$7889ffcc@comstock.com
обсуждение исходный текст
Ответ на alter table question  (Medi Montaseri <medi@cybershell.com>)
Список pgsql-general
One option would be to rename the column (IIRC, that's allowable by
PostgreSQL) and then add the column back in with the datatype that you want,
then repopulate that field with the data from the old column. Of course,
this just creates an unused, unwanted column just hanging around. Not to
mention that it could be a real problem if the column is part of a foreign
key or has constraints tied to it.

Personally, if you can afford to do it, I think drop-create is the best
solution, as painful as that is to admit.

Greg

----- Original Message -----
From: "Medi Montaseri" <medi@cybershell.com>
To: <pgsql-general@postgresql.org>
Sent: Saturday, March 02, 2002 3:43 AM
Subject: [GENERAL] alter table question


> How can I alter  a column's data type in PG?
>
> If PG does not support such a change, what is a typical or clever
> way of doing that?
>
> I had to drop-create table a couple of times, but that does not
> feel right. I know informix allows you to do that.
>
> Thanks
>
> --
> -------------------------------------------------------------------------
> Medi Montaseri                               medi@CyberShell.com
> Unix Distributed Systems Engineer            HTTP://www.CyberShell.com
> CyberShell Engineering
> -------------------------------------------------------------------------
>
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org
>


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

Предыдущее
От: Ioannis
Дата:
Сообщение: postgre performance question
Следующее
От: "Gregory Wood"
Дата:
Сообщение: Re: oids vs. serial question