Search Postgresql Archives

alter varchar() column length?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Is there a way to alter a varchar column’s length?  Maybe something like “alter table foo alter column xyz varchar(256)”.

 

My alternative seems very messy...

-          alter table, add a new column with the desired varchar length.  call it “temp”

-          insert into “temp” the value of the old column.

-          alter table, drop the old column (messing up all the indexes on that column in the process I suppose)

-          alter table, add a new column with the same name as the one you just deleted, only with the desired length

-          insert into that new column the value in “temp”

-          alter table, drop “temp”

-          recreate all the indexes

 

Thanks

-dave


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux