Re: Alter definition of a column

From: "Josh Williams" <drykath(at)runbox(dot)com>
To: kelly(dot)burkhart(at)gmail(dot)com
Cc: pgsql-general(at)postgresql(dot)org, kleptog(at)svana(dot)org, af300wsm(at)gmail(dot)com, shoaibmir(at)gmail(dot)com
Subject: Re: Alter definition of a column
Date: 2007-01-20 21:12:41
Message-ID: E1H8NVx-0004Wh-Nj@garm.runbox.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

From: "Kelly Burkhart" <kelly(dot)burkhart(at)gmail(dot)com>
> On 1/20/07, Shoaib Mir <shoaibmir(at)gmail(dot)com> wrote:
> > Should help --> ALTER TABLE tablename ALTER columname TYPE text;
>
> I was looking for a way to alter a column from varchar(n) to text
> without using the alter command and consequently touching every single
> row. Below is sql which seems to work, but is it advisable to do such
> shenanigans? (are varchar and text the same thing)?

Always have been under the impression myself that text and varchar (and character varying for that matter) were all aliases for the exact same thing in the back end. Just the latter allows for that limit (n) to be specified if your specs require. Leaving that off saves a few validation cycles, but at the possible expense of schema and data incompatability with other systems should that ever matter.

So yeah, I don't see any reason it shouldn't work just fine.

- Josh Williams

In response to

Browse pgsql-general by date

  From Date Subject
Next Message webb.sprague 2007-01-20 22:10:20 Regular expressions and arrays and ANY() question
Previous Message Shoaib Mir 2007-01-20 20:32:14 Re: Alter definition of a column