pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: sandhya <sandhyar@amiindia.co.in>
To: postgre <pgsql-admin@postgresql.org>
Cc: sandhya <sandhyar@amiindia.co.in>
Subject: Fw: Reg: Changing Column type
Date: Wed, 16 Nov 2005 18:37:49 +0530
Message-ID: <030901c5eaae$bec0c280$cd00000a@amiindiahjwbgh> (raw)


> 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@sss.pgh.pa.us>
> To: "sandhya" <sandhyar@amiindia.co.in>
> Cc: "postgre" <pgsql-admin@postgresql.org>
> Sent: Tuesday, November 15, 2005 8:02 PM
> Subject: Re: [ADMIN] Reg: Changing Column type
>
>
> > "sandhya" <sandhyar@amiindia.co.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
>




view thread (4+ messages)  latest in thread

Message-ID: <030901c5eaae$bec0c280$cd00000a@amiindiahjwbgh>
Permalink:  ../030901c5eaae$bec0c280$cd00000a@amiindiahjwbgh/
Also on:    postgresql.org/message-id/030901c5eaae$bec0c280$cd00000a@amiindiahjwbgh

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-admin@postgresql.org
  Cc: sandhyar@amiindia.co.in
  Subject: Re: Fw: Reg: Changing Column type
  In-Reply-To: <030901c5eaae$bec0c280$cd00000a@amiindiahjwbgh>
  References: <030901c5eaae$bec0c280$cd00000a@amiindiahjwbgh>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox