Re: Untitled

From: Erwin Moller <erwin(at)_no_spam_dexus(dot)nl>
To: pgsql-admin(at)postgresql(dot)org
Subject: Re: Untitled
Date: 2003-03-26 07:19:05
Message-ID: 3e81541b$0$49104$e4fe514c@news.xs4all.nl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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
>
>
>

In response to

  • at 2002-12-12 06:39:14 from Mukund Pate

Browse pgsql-admin by date

  From Date Subject
Next Message Daniel Rubio 2003-03-26 07:49:15 Re: Can't connect to my postgresql
Previous Message Devi Munandar 2003-03-26 04:58:44 postgresql port (5432) is closed