Re: Changing column data type on an existing table

From: Bricklen Anderson <BAnderson(at)PresiNET(dot)com>
To:
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Changing column data type on an existing table
Date: 2005-05-13 18:13:03
Message-ID: 4284EE2F.5020502@PresiNET.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

> Joe Audette wrote:
>
> Hi,
>
> I have an app that I released with a particular field
> as varchar 255.
>
> Can someone give me a script example I can use to make
> an upgrade script to change it to text or at least to
> larger varchar without losing existing data?
>
> I support 3 different dbs in my app, Postgre is the
> newest and least familiar to me but I am trying to
> learn.
>
> Any help much appreciated.
>
> Joe Audette

In v8 at least, you can issue:
alter TABLE <tablename> ALTER <column_name> TYPE text;

--
_______________________________

This e-mail may be privileged and/or confidential, and the sender does
not waive any related rights and obligations. Any distribution, use or
copying of this e-mail or the information it contains by other than an
intended recipient is unauthorized. If you received this e-mail in
error, please advise me (by return e-mail or otherwise) immediately.
_______________________________

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Andrew Sullivan 2005-05-13 18:46:35 Re: WHERE
Previous Message Brad Nicholson 2005-05-13 18:00:49 Re: Changing column data type on an existing table