Re: altering the datatype of a column.

From: Oliver Elphick <olly(at)lfix(dot)co(dot)uk>
To: Prabu Subroto <prabu_subroto(at)yahoo(dot)com>
Cc: Postgres General Milis <pgsql-general(at)postgresql(dot)org>
Subject: Re: altering the datatype of a column.
Date: 2004-08-04 18:02:24
Message-ID: 1091642544.31602.3090.camel@linda
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Wed, 2004-08-04 at 18:47, Prabu Subroto wrote:
> Dear my friends...
>
> I want to change the datatype of a completed table
> (has had already content).
> But I don't know how.
...
> Please tell me how.

It is not possible in 7.4

Create a new column of the correct type; update the table to set the new
column to have the data from the old one; delete the old column; rename
the new one.

--
Oliver Elphick olly(at)lfix(dot)co(dot)uk
Isle of Wight http://www.lfix.co.uk/oliver
GPG: 1024D/A54310EA 92C8 39E7 280E 3631 3F0E 1EC0 5664 7A2F A543 10EA
========================================
"And not only so, but we glory in tribulations also;
knowing that tribulation worketh patience; And
patience, experience; and experience, hope."
Romans 5:3,4

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Jim C. Nasby 2004-08-04 18:31:46 Re: Casting timestamp with time zone to varchar automatically
Previous Message David Rysdam 2004-08-04 17:58:58 Re: COPY not handling BLOBs