Re: Untitled - Mailing list pgsql-admin

From Erwin Moller
Subject Re: Untitled
Date
Msg-id 3e81541b$0$49104$e4fe514c@news.xs4all.nl
Whole thread Raw
In response to ...  (Mukund Pate <patemukund@yahoo.com>)
List pgsql-admin
Mukund Pate wrote:

> --0-762086988-1039675154=:50830
> Content-Type: text/plain; charset=us-ascii
>
>
> hello,
>
> how to modify the datatype of column in a table?
>
> i have created table with one coulmn datatype is varchar(200) so i  would
> like to change to text datatype
>

Hi,

Please take the time to fill in a subject next time you post.

To your question:
You cannot change the datatype in an existing table.
If you are using Postgres 7.3 (next time you post please give us some
backgroundinformation like your Postgresversion and OS) you can add a
column of the texttype to your table and give a simple SQL-command to
populate it. (UPDATE tblyourtable SET newcolumn=oldcolumn)

Then drop the old column.

If you are using triggers (Foreign keys for example) or indexes on the
column, you better think it over first and recreate them afterwards.

Regards,
Erwin
> thanks in advance
>
> mukund
>
>
>

pgsql-admin by date:

Previous
From: sdurand@insa-rouen.fr
Date:
Subject: JSP ???
Next
From: Bruce Momjian
Date:
Subject: Re: Monitoring server loads