From: | Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com> |
---|---|
To: | Cheng Kai <chengk(at)isse(dot)kuis(dot)kyoto-u(dot)ac(dot)jp> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: How to alter the size of a column |
Date: | 2000-08-01 16:51:35 |
Message-ID: | Pine.BSF.4.10.10008010947580.23881-100000@megazone23.bigpanda.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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(at)bigpanda(dot)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
>
From | Date | Subject | |
---|---|---|---|
Next Message | Bruce Momjian | 2000-08-01 17:42:59 | Re: auto rollback |
Previous Message | Tom Lane | 2000-08-01 16:02:36 | random() function produces wrong range |