Fw: Reg: Changing Column type

From: "sandhya" <sandhyar(at)amiindia(dot)co(dot)in>
To: "postgre" <pgsql-admin(at)postgresql(dot)org>
Cc: "sandhya" <sandhyar(at)amiindia(dot)co(dot)in>
Subject: Fw: Reg: Changing Column type
Date: 2005-11-16 13:07:49
Message-ID: 030901c5eaae$bec0c280$cd00000a@amiindiahjwbgh
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin


> Hi all,
> I have PostGreSql -8 .2.0 version only.
>
> say i have a table(sample) with 2 columns like:
> name varchar(20),age int;
>
> But when i give ALTER TABLE sample ALTER COLUMN age TYPE char;
> It is working fine.
>
> BUT when i try to do the same for converting the "char/text" type data to
> "int" still i am getting error as,
>
> like,ALTER TABLE sample ALTER COLUMN age TYPE int;
>
> ERROR: column "age" cannot be cast to type "pg_catalog.int4"
>
> Pls tell me how to do this.Am i wrong some where.If So,suggest me.
>
> Thanks&Regards
> Sandhya R
>
>
>
>
>
> ----- Original Message -----
> From: "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
> To: "sandhya" <sandhyar(at)amiindia(dot)co(dot)in>
> Cc: "postgre" <pgsql-admin(at)postgresql(dot)org>
> Sent: Tuesday, November 15, 2005 8:02 PM
> Subject: Re: [ADMIN] Reg: Changing Column type
>
>
> > "sandhya" <sandhyar(at)amiindia(dot)co(dot)in> writes:
> > > When i am tring to change the column type from character/Varchar to =
> > > "int" i am getting error like,
> > > ERROR: column "fname" cannot be cast to type "int4"
> >
> > If this is a pre-8.0 PG version, try casting to text and then int4.
> >
> > If 8.0 or later, it should work as is --- would you show us exactly
> > what you did?
> >
> > regards, tom lane
>

Browse pgsql-admin by date

  From Date Subject
Next Message Wim Bertels 2005-11-16 13:25:44 md5 collision generator
Previous Message Yogvinder Singh 2005-11-16 10:45:27 restore challenge