From: Bruno Wolff III <bruno@wolff.to>
To: Chris Faulkner <chrisf@oramap.com>
Cc: Pgsql-Sql <pgsql-sql@postgresql.org>
Subject: Re: create new field
Date: Mon, 6 Oct 2003 11:56:09 -0500
Message-ID: <20031006165609.GC27925@wolff.to> (raw)
In-Reply-To: <DGENKIKMJILAAKJGFHKFAEHPCIAA.chrisf@oramap.com>
References: <DGENKIKMJILAAKJGFHKFAEHPCIAA.chrisf@oramap.com>
On Mon, Oct 06, 2003 at 17:35:11 +0100,
Chris Faulkner <chrisf@oramap.com> 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.
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 using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: bruno@wolff.to, chrisf@oramap.com
Subject: Re: create new field
In-Reply-To: <20031006165609.GC27925@wolff.to>
* 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