X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 0B25DDA387 for ; Wed, 16 Nov 2005 08:59:59 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 02655-01 for ; Wed, 16 Nov 2005 13:00:01 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mars.amiindia.co.in (unknown [203.199.198.229]) by svr1.postgresql.org (Postfix) with ESMTP id AD257DB927 for ; Wed, 16 Nov 2005 08:59:53 -0400 (AST) Received: from amiindiahjwbgh ([10.0.0.205]) (authenticated bits=0) by mars.amiindia.co.in (8.12.11/8.12.11) with ESMTP id jAGD88oD030248; Wed, 16 Nov 2005 18:38:08 +0530 Message-ID: <030901c5eaae$bec0c280$cd00000a@amiindiahjwbgh> From: "sandhya" To: "postgre" Cc: "sandhya" Subject: Fw: Reg: Changing Column type Date: Wed, 16 Nov 2005 18:37:49 +0530 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2800.1437 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1441 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.001 required=5 tests=[AWL=0.001] X-Spam-Score: 0.001 X-Spam-Level: X-Archive-Number: 200511/204 X-Sequence-Number: 19577 > 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" > To: "sandhya" > Cc: "postgre" > Sent: Tuesday, November 15, 2005 8:02 PM > Subject: Re: [ADMIN] Reg: Changing Column type > > > > "sandhya" 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 >