Re: Quick way to alter a column type?

From: Ow Mun Heng <Ow(dot)Mun(dot)Heng(at)wdc(dot)com>
To: Lew <conrad(at)lwsc(dot)ehost-services(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Quick way to alter a column type?
Date: 2008-07-09 03:09:49
Message-ID: 1215572989.22595.1.camel@neuromancer.home.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Mon, 2008-07-07 at 02:10 -0400, Lew wrote:
> Ow Mun Heng wrote:
> >> I want to change a column type from varchar(4) to varchar(5) or should I
> >> just use text instead.

> The choice of TEXT for the column would seem to be supported in the PG manual,
> which stresses that TEXT and VARCHAR are quite close in performance, if not
> identical. I recommend to constrain the length if it's proper for the data
> domain. That is, if you are 100% absolutely certifiably certain that the
> length will never change again once you set it to 5, that is, if the data
> domain is a set of values that must be no more than 5 characters long, then
> VARCHAR(5) is a good choice. It accurately represents the data.

It was varchar(4) for a _long_ time until there came a need recently to
move it to a 5 characters.
Hence the issue, I've already changed it to varchar() instead to make it
more open (and less problematic in the future)

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Artacus 2008-07-09 03:16:50 Re: array sort for varchar arrays?
Previous Message Goldeneye Solutions Information 2008-07-09 00:49:49 Feature: FOR UPDATE SKIP LOCKED