Re: Altering a column type - Most efficient way

From: Ow Mun Heng <Ow(dot)Mun(dot)Heng(at)wdc(dot)com>
To: Mario Weilguni <mweilguni(at)sime(dot)com>
Cc: Pgsql performance <pgsql-performance(at)postgresql(dot)org>
Subject: Re: Altering a column type - Most efficient way
Date: 2008-07-10 09:34:41
Message-ID: 1215682481.15319.14.camel@neuromancer.home.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

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.

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Jessica Richard 2008-07-10 10:53:40 how big shmmax is good for Postgres...
Previous Message Mario Weilguni 2008-07-10 08:36:10 Re: Altering a column type - Most efficient way