Re: How to change data type in column ? - Mailing list pgsql-general

From Richard Huxton
Subject Re: How to change data type in column ?
Date
Msg-id 200304151114.19157.dev@archonet.com
Whole thread Raw
In response to How to change data type in column ?  ("Vitali Djatsuk" <Vitali.Djatsuk@MicroLink.ee>)
List pgsql-general
On Tuesday 15 Apr 2003 10:36 am, Vitali Djatsuk wrote:
> Hi,
>
> How can I change a data type in column ?

Well, the closest you could get would be something like:

ALTER TABLE RENAME column TO backup_column;
ALTER TABLE ADD COLUMN column ...;
...copy and transform data...
ALTER TABLE DROP COLUMN backup_column;

Personally, I tend to dump/recreate the table where possible, but I might be a
little paranoid there.
I think you'll need to recreate any triggers/FK's in either case.
--
  Richard Huxton


pgsql-general by date:

Previous
From: "Wayne Armstrong"
Date:
Subject: Re: Are we losing momentum?
Next
From: Shridhar Daithankar
Date:
Subject: Re: Two 'identical' DB's not acting identically