Re: Altering a column type - Most efficient way

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

 



On Thu, 2008-07-10 at 10:36 +0200, Mario Weilguni wrote:
> Ow Mun Heng schrieb:
> >
> > I want to change a column type from varchar(4) to varchar()
> >
> >   
> Example:
> {OLDLEN} = 4
> {NEWLEN} = 60
> 
> update pg_attribute
>    set atttypmod={NEWLEN}+4
>  where attname='the-name-of-the-column'
>    and attrelid=(select oid from pg_class where 
> relname='the-name-of-the-table')
>    and atttypmod={OLDLEN}+4;
> 

This is what I see on the table

NEW attypmod = -1
OLD attypmod =  8

I'm not very confident in doint this change since this is not a
development server. If would help though if someone else has any other
suggestion or something.. Thanks for the information though, it's
enlightening knowledge.


[Postgresql General]     [Postgresql PHP]     [PHP Users]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Yosemite]

  Powered by Linux