X-Original-To: pgsql-sql@postgresql.org Received: from spampd.localdomain (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 441DF475EA4 for ; Tue, 25 Mar 2003 11:50:37 -0500 (EST) Received: from smtp.web.de (smtp01.web.de [217.72.192.180]) by postgresql.org (Postfix) with ESMTP id 4E4FC475E4D for ; Tue, 25 Mar 2003 11:50:36 -0500 (EST) Received: from p5081887e.dip0.t-ipconnect.de ([80.129.136.126] helo=web.de) by smtp.web.de with asmtp (TLSv1:RC4-MD5:128) (WEB.DE(Exim) 4.97 #53) id 18xrdI-0006Kf-00 for pgsql-sql@postgresql.org; Tue, 25 Mar 2003 17:50:40 +0100 Message-ID: <3E8088E1.5030700@web.de> Date: Tue, 25 Mar 2003 17:50:41 +0100 From: Andreas Pflug User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.3) Gecko/20030312 X-Accept-Language: en-us, en MIME-Version: 1.0 To: pgsql-sql@postgresql.org Subject: Re: How to increase Column width of table References: <3E807332.9C5EBEE@rodos.fzk.de> In-Reply-To: <3E807332.9C5EBEE@rodos.fzk.de> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, hits=-34.4 required=5.0 tests=BAYES_01,EMAIL_ATTRIBUTION,IN_REP_TO,RCVD_IN_NJABL, REFERENCES,REPLY_WITH_QUOTES,USER_AGENT_MOZILLA_UA 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/558 X-Sequence-Number: 12596 Christoph Haller wrote: >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 > > This has many side effects, like dropped indices that have to be recreated etc. You can rename your old column, create a new column varchar(100), update ... set newCol=oldCol, drop oldCol and rename newCol to oldCol See ALTER TABLE doc for this. > >---------------------------(end of broadcast)--------------------------- >TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org > > >