Re: Quick way to alter a column type?

From: "Richard Broersma" <richard(dot)broersma(at)gmail(dot)com>
To: "Ow Mun Heng" <Ow(dot)Mun(dot)Heng(at)wdc(dot)com>
Cc: Lew <conrad(at)lwsc(dot)ehost-services(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: Quick way to alter a column type?
Date: 2008-07-09 04:42:58
Message-ID: 396486430807082142o3e3e6a59n47d5f60950a8017f@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Tue, Jul 8, 2008 at 8:09 PM, Ow Mun Heng <Ow(dot)Mun(dot)Heng(at)wdc(dot)com> wrote:
> 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)

To prevent this issue from re-occuring in the future, you could use
text and then add a check( length( col ) <= 5 ).

--
Regards,
Richard Broersma Jr.

Visit the Los Angles PostgreSQL Users Group (LAPUG)
http://pugs.postgresql.org/lapug

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2008-07-09 04:48:34 Re: Feature: FOR UPDATE SKIP LOCKED
Previous Message Klint Gore 2008-07-09 04:36:56 Re: Getting source code for database objects