Received: from localhost (unknown [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id CCDB165054C for ; Thu, 10 Jul 2008 06:34:49 -0300 (ADT) Received: from postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 27519-03 for ; Thu, 10 Jul 2008 06:34:41 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from wdscexfe02.sc.wdc.com (wdscexfe02.sc.wdc.com [129.253.170.52]) by postgresql.org (Postfix) with ESMTP id DEDE5650548 for ; Thu, 10 Jul 2008 06:34:44 -0300 (ADT) Received: from wdmyexbe03.my.asia.wdc.com ([129.253.105.55]) by wdscexfe02.sc.wdc.com with Microsoft SMTPSVC(6.0.3790.1830); Thu, 10 Jul 2008 02:34:17 -0700 Received: from 129.253.110.56 ([129.253.110.56]) by wdmyexbe03.my.asia.wdc.com ([129.253.105.55]) with Microsoft Exchange Server HTTP-DAV ; Thu, 10 Jul 2008 09:34:13 +0000 Received: from neuromancer by 129.253.105.55; 10 Jul 2008 17:34:41 +0800 Subject: Re: Altering a column type - Most efficient way From: Ow Mun Heng To: Mario Weilguni Cc: Pgsql performance In-Reply-To: <4875C9FA.7020101@sime.com> References: <1215676380.15319.2.camel@neuromancer.home.net> <4875C9FA.7020101@sime.com> Content-Type: text/plain Content-Transfer-Encoding: 7bit Date: Thu, 10 Jul 2008 17:34:41 +0800 Message-Id: <1215682481.15319.14.camel@neuromancer.home.net> Mime-Version: 1.0 X-Mailer: Evolution 2.22.0 X-OriginalArrivalTime: 10 Jul 2008 09:34:17.0722 (UTC) FILETIME=[1FC41DA0:01C8E270] X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200807/87 X-Sequence-Number: 30687 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.