Re: alter column witdh

From: Christoph Haller <ch(at)rodos(dot)fzk(dot)de>
To: pgsql-sql(at)postgresql(dot)org
Cc: eric(at)vianet-express(dot)com(dot)br
Subject: Re: alter column witdh
Date: 2003-05-27 15:07:11
Message-ID: 3ED37F1F.3060209@rodos.fzk.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

>
> how can I alter the column width
>
Something like

begin ;

alter table foo rename column b to b_old ;
alter table foo add column b_new character(20) ;
update foo set b_new = b_old ;
alter table foo drop column b_old ;
alter table foo rename column b_new to b ;

commit ;

does the trick. Refer to the archives too.

Regards, Christoph

Browse pgsql-sql by date

  From Date Subject
Next Message Wei Weng 2003-05-27 15:11:51 Re: [SQL] Perl Book
Previous Message Thomas Good 2003-05-27 15:06:12 Re: [Fwd: SQL book]