From: Bruno Wolff III <bruno@wolff.to>
To: Jorge Godoy <jgodoy@gmail.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: Returning String as Integer
Date: Sat, 6 May 2006 10:39:16 -0500
Message-ID: <20060506153916.GA3434@wolff.to> (raw)
In-Reply-To: <200605051852.19596.jgodoy@gmail.com>
References: <18AE59788A3FC640A367E5652E664D8002093F0C@xmb-sjc-237.amer.cisco.com>
<200605051852.19596.jgodoy@gmail.com>
On Fri, May 05, 2006 at 18:52:19 -0300,
Jorge Godoy <jgodoy@gmail.com> wrote:
> Em Sexta 05 Maio 2006 18:37, Kashmira Patel (kupatel) escreveu:
> > Hi all,
> > I have a table with a column of type 'text'. It mainly contains
> > numbers. Is there any way to select a value from this column and return
> > it as an integer?
>
> testing=# select '123'::integer;
> int4
> ------
> 123
> (1 registro)
Note that that isn't the same thing. The '123' above is not treated as
being of type text. If you actually wanted to test this conversion you
would want to do:
bruno=> select '123'::text::integer;
int4
------
123
(1 row)
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, jgodoy@gmail.com
Subject: Re: Returning String as Integer
In-Reply-To: <20060506153916.GA3434@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