Re: Smartest way to resize a column?

From: "Ian Barwick" <barwick(at)gmail(dot)com>
To: "Phoenix Kiula" <phoenix(dot)kiula(at)gmail(dot)com>
Cc: "PG-General Mailing List" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Smartest way to resize a column?
Date: 2009-01-12 01:12:23
Message-ID: 1d581afe0901111712l55f4fba9x8669f082391bf0d4@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

2009/1/12 Phoenix Kiula <phoenix(dot)kiula(at)gmail(dot)com>:
> I am trying to resize a column on a large-ish database (with 5 million rows).
>
> The column was 20 characters before, now I want to make it 35 characters.
>
> Challenge is: this is the main indexed column in a busy database.
>
> I tried looking at the ALTER TABLE commands available and there seems
> nothing that allows me to simply change column size from varchar(20)
> to varchar(35)?

The syntax you want (at least in more recent PostgreSQL versions, you don't
mention which version you have) is:

ALTER TABLE users ALTER COLUMN name TYPE VARCHAR(35)

HTH

Ian Barwick

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Adrian Klaver 2009-01-12 01:14:40 Re: Smartest way to resize a column?
Previous Message Phoenix Kiula 2009-01-12 01:07:31 Smartest way to resize a column?