Re: Changed a column type from "integer" to varchar

From: Ying Lu <ying_lu(at)cs(dot)concordia(dot)ca>
To: Greg Donald <destiney(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Changed a column type from "integer" to varchar
Date: 2004-09-14 21:06:49
Message-ID: 41475D69.7050605@cs.concordia.ca
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)commandprompt(dot)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?
>
>
>
>

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Duane Lee - EGOVX 2004-09-14 21:15:51 Re: Spacing in output
Previous Message Jerome Lyles 2004-09-14 21:05:46 Spacing in output