Re: Char to Int

From: Ron Johnson <ron(dot)l(dot)johnson(at)cox(dot)net>
To: PgSQL General ML <pgsql-general(at)postgresql(dot)org>
Subject: Re: Char to Int
Date: 2003-10-14 21:53:56
Message-ID: 1066168436.12390.60.camel@haggis
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Tue, 2003-10-14 at 16:11, Rick Seeger wrote:
> -----Original Message-----
>
> Oops, there was a typo in my second example. Still have the problem
> tho...
>
> > rs=#
> > rs=# insert into table2
> > rs=# select CAST(my_Id as integer)
> > ^^^^
> > rs=# from table1;
> > ERROR: Cannot cast type character to integer

Interesting, though, that it works for string constants:

test1=# select cast('15' as integer);
int4
------
15
(1 row)

test1=# select '15'::integer;
int4
------
15
(1 row)

--
-----------------------------------------------------------------
Ron Johnson, Jr. ron(dot)l(dot)johnson(at)cox(dot)net
Jefferson, LA USA

When Swedes start committing terrorism, I'll become suspicious of
Scandanavians.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Peter Eisentraut 2003-10-14 21:55:04 Re: Char to Int
Previous Message Edwin Quijada 2003-10-14 21:20:57 Re: Virtual Machines and postgres