Re: Changed a column type from "integer" to varchar - Mailing list pgsql-general

From Ying Lu
Subject Re: Changed a column type from "integer" to varchar
Date
Msg-id 41475D69.7050605@cs.concordia.ca
Whole thread Raw
In response to Re: Changed a column type from "integer" to varchar  (Greg Donald <destiney@gmail.com>)
List pgsql-general
Currently, what I did is like

. alter table test add column machineIDnew varchar;
. update test set machineIDnew = machineID;
. alter table test rename machineIDnew to machineID;
. vacuum full table;

If better ways, please let me know.

Thanks a lot,


Greg Donald wrote:

>On Tue, 14 Sep 2004 13:33:32 -0700, Joshua D. Drake
><jd@commandprompt.com> wrote:
>
>
>>You can not currently change the data type with alter table.
>>
>>
>
>Are there any plans to add this functionality?
>
>What's the best workaround?  Add a new column, copy data from old
>column to new column, drop old column?
>
>
>
>


pgsql-general by date:

Previous
From: Jerome Lyles
Date:
Subject: Spacing in output
Next
From: Alvaro Herrera
Date:
Subject: Re: Changed a column type from "integer" to varchar