Re: How to alter the size of a column - Mailing list pgsql-general

From Stephan Szabo
Subject Re: How to alter the size of a column
Date
Msg-id Pine.BSF.4.10.10008010947580.23881-100000@megazone23.bigpanda.com
Whole thread Raw
In response to How to alter the size of a column  ("Cheng Kai" <chengk@isse.kuis.kyoto-u.ac.jp>)
List pgsql-general
Right now the best way is probably:

create table newtable ( ... new column info ... )
insert into newtable select * from oldtable;
alter table oldtable rename to old_oldtable;
alter table newtable rename to oldtable;

In the second line, you may not be able to get away with a
* if you're doing more complicated changes of types that
can't automatically converted.  And once you're done and
sure everything is working,  you can delete the backup of
the old table.

Stephan Szabo
sszabo@bigpanda.com

On Tue, 1 Aug 2000, Cheng Kai wrote:

> Hi,
>
>      I want to alter the size of a column, say from char(40) to char(80),
> but it seem that
> the  ALTER does not support such operation, nor does it support column
> removing.
>
>      How can I do for this ?
>
>
>      Thanks
>


pgsql-general by date:

Previous
From: brianb-pggeneral@edsamail.com
Date:
Subject: Re: [HACKERS] pg_dump & performance degradation
Next
From: jeff seaman
Date:
Subject: auto rollback