Re: Resize varchar column

From: Bruno Wolff III <bruno(at)wolff(dot)to>
To: John Sidney-Woollett <johnsw(at)wardbrook(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Resize varchar column
Date: 2004-02-04 15:08:59
Message-ID: 20040204150859.GA19840@wolff.to
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Wed, Feb 04, 2004 at 14:45:37 -0000,
John Sidney-Woollett <johnsw(at)wardbrook(dot)com> wrote:
> Is it possible to alter a table to resize a varchar column? The PG docs
> indicate lots of uses for "alter table T alter column C..." but not one
> that allows the changing of the type (or same type, new size).
>
> This is possible in Oracle (provided you are increasing the column size).
>
> Is there a way to resize the column without having to drop or recreate the
> table or column?

It is possible to change the size of varchar data by updating the system
catalogs. I don't know the exact details of what to do, but the instructions
should be in the archives (multiple times).

In general (in 7.4.x) you can change data types using add, drop, rename and
a query to copy/translate the data. This will have the side effect of making
the updated column the last column when using * to refer to the table's columns.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2004-02-04 15:52:22 Re: Anyone has nls activated on Mac OS X?
Previous Message John Sidney-Woollett 2004-02-04 14:45:37 Resize varchar column