X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id A8AC15E46C3 for ; Wed, 1 Sep 2004 13:33:30 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 47227-04 for ; Wed, 1 Sep 2004 16:33:36 +0000 (GMT) Received: from davinci.ethosmedia.com (server226.ethosmedia.com [209.128.84.226]) by svr1.postgresql.org (Postfix) with ESMTP id E49725E470A for ; Wed, 1 Sep 2004 13:33:28 -0300 (ADT) Received: from [63.195.55.98] (HELO spooky) by davinci.ethosmedia.com (CommuniGate Pro SMTP 4.1.8) with ESMTP id 6244569; Wed, 01 Sep 2004 09:34:54 -0700 Content-Type: text/plain; charset="iso-8859-1" From: Josh Berkus Organization: Aglio Database Solutions To: "Michael Ryan S. Puncia" , Subject: Re: Changing the column length Date: Wed, 1 Sep 2004 09:32:24 -0700 User-Agent: KMail/1.4.3 References: <200409010641.i816fDkJ025384@mail.census.gov.ph> In-Reply-To: <200409010641.i816fDkJ025384@mail.census.gov.ph> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Message-Id: <200409010932.24702.josh@agliodbs.com> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200409/15 X-Sequence-Number: 8143 Michael, > I am sorry that my question is out of line with this > group(performance) but I need > > an urgent help :-( .pls .. I need to know how to change the length of the > column. In the future, try to provide more detail on your problem. Fortunately, I think I know what it is. PostgreSQL does not support changing the length of VARCHAR columns in-place until version 8.0 (currently in beta). Instead, you need to: 1) Add a new column of the correct length; 2) Copy the data in the old column to the new column; 3) Drop the old column; 4) Rename the new column to the same name as the old column. I realize that this approach can be quite painful if you have dependant views, contstraints, etc. It's why we fixed it for 8.0. You can also: 1) pg_dump the database in text format; 2) edit the table definition in the pg_dump file; 3) re-load the database While it *is* possible to change the column size by updating the system tables, doing so is NOT recommended as it can cause unexpected database errors. -- Josh Berkus Aglio Database Solutions San Francisco