X-Original-To: pgsql-sql@postgresql.org Received: from spampd.localdomain (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 01CB6475A71 for ; Tue, 25 Mar 2003 11:47:31 -0500 (EST) Received: from localhost.localdomain (unknown [65.217.53.66]) by postgresql.org (Postfix) with ESMTP id 0B021474E44 for ; Tue, 25 Mar 2003 11:47:30 -0500 (EST) Received: from thorn.mmrd.com (thorn.mmrd.com [172.25.10.100]) by localhost.localdomain (8.12.5/8.12.5) with ESMTP id h2PHLU6P006868; Tue, 25 Mar 2003 12:21:31 -0500 Received: from gnvex001.mmrd.com (gnvex001.mmrd.com [192.168.3.55]) by thorn.mmrd.com (8.11.6/8.11.6) with ESMTP id h2PGkVp04950; Tue, 25 Mar 2003 11:46:31 -0500 Received: from camel.mmrd.com ([172.25.5.213]) by gnvex001.mmrd.com with SMTP (Microsoft Exchange Internet Mail Service Version 5.5.2653.13) id F3HTK4JD; Tue, 25 Mar 2003 11:46:30 -0500 Subject: Re: How to increase Column width of table From: Robert Treat To: Christoph Haller Cc: pgsql-sql@postgresql.org, atul@imcindia.net In-Reply-To: <3E807332.9C5EBEE@rodos.fzk.de> References: <3E807332.9C5EBEE@rodos.fzk.de> Content-Type: text/plain Content-Transfer-Encoding: 7bit X-Mailer: Ximian Evolution 1.0.8 Date: 25 Mar 2003 11:46:30 -0500 Message-Id: <1048610790.13799.491.camel@camel> Mime-Version: 1.0 X-Spam-Status: No, hits=-38.8 required=5.0 tests=BAYES_01,EMAIL_ATTRIBUTION,IN_REP_TO,QUOTED_EMAIL_TEXT, REFERENCES,REPLY_WITH_QUOTES,USER_AGENT_XIMIAN autolearn=ham version=2.50 X-Spam-Level: X-Spam-Checker-Version: SpamAssassin 2.50 (1.173-2003-02-20-exp) X-Archive-Number: 200303/556 X-Sequence-Number: 12594 http://fts.postgresql.org/db/mw/msg.html?mid=1071582 On Tue, 2003-03-25 at 10:18, Christoph Haller wrote: > > > > Atul here, i have one table and i would like to increase the length > of > > existing column and the sql statement is > > > > Exisiting Column is "vehicle_make" varchar(30) > > > > SQL: alter table commute_profile alter column "vehicle_make" > > varchar(100) > > > > But this gives error. > > > > ERROR: parser: parse error at or near "varchar" > > > I'm afraid there is no one-step-solution to this. > You'll have to go the hard way as > > CREATE new_table ( > ... > ... varchar(100), > ... > ); > INSERT INTO new_table as SELECT * FROM old_table; > DROP old_table; > ALTER TABLE new_table RENAME TO old_table; > And don't forget about re-creating related indexes etc. > > Regards, Christoph