X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id 6968DD1B52E for ; Mon, 6 Oct 2003 16:49:34 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 03670-05 for ; Mon, 6 Oct 2003 13:48:46 -0300 (ADT) Received: from wolff.to (wolff.to [66.93.249.74]) by svr1.postgresql.org (Postfix) with SMTP id 28B12D1B566 for ; Mon, 6 Oct 2003 13:48:45 -0300 (ADT) Received: (qmail 28233 invoked by uid 500); 6 Oct 2003 16:56:10 -0000 Date: Mon, 6 Oct 2003 11:56:09 -0500 From: Bruno Wolff III To: Chris Faulkner Cc: Pgsql-Sql Subject: Re: create new field Message-ID: <20031006165609.GC27925@wolff.to> Mail-Followup-To: Chris Faulkner , Pgsql-Sql References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.4i X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200310/75 X-Sequence-Number: 15475 On Mon, Oct 06, 2003 at 17:35:11 +0100, Chris Faulkner wrote: > > OK - so I tried casting. > > template1=# update tab set new_col = "OLD_COL"::int4; > ERROR: Cannot cast type character to integer > > I understand this - some tables might have characters in the varchar but how > to get around it in my case ? I know that my character field has only > integers in it ? You want to use to_number to do the conversion.