Re: trying to alter column

From: Scott Marlowe <scott(dot)marlowe(at)gmail(dot)com>
To: Aras Angelo <araskoktas(at)gmail(dot)com>
Cc: pgsql-admin(at)postgresql(dot)org
Subject: Re: trying to alter column
Date: 2009-08-20 02:44:06
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-admin

On Wed, Aug 19, 2009 at 6:20 PM, Aras Angelo<araskoktas(at)gmail(dot)com> wrote:
> Im trying to alter a column type from character varying(8) to int.
> All the values in the column are numbers but im getting this message
> column "xxxxxx" cannot be cast to type integer
> Dropping and readding the column is an option but downtime is very critical
> to us, so i was wondering
> if im doing something wrong and i can alter type somehow.

alter table xyz alter COLUMN i type int using i::int;

Note that this will fail if any of the entries in teh column i are not ints.

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Kumar Anand 2009-08-20 09:36:45 select count is too slow
Previous Message Aras Angelo 2009-08-20 00:20:45 trying to alter column