From: Joel Burton <joel@joelburton.com>
To: Scott Royston <scroyston@mac.com>
To: pgsql-sql@postgresql.org
Subject: Re: can't cast varchar as integer?
Date: Tue, 14 May 2002 17:20:20 -0400
Message-ID: <JGEPJNMCKODMDHGOBKDNIEEICOAA.joel@joelburton.com> (raw)
In-Reply-To: <4EE21904-676C-11D6-BF4D-000393577144@mac.com>
> what's the reasoning behind not being able to cast a varchar as
> integer? this seems very weird to me:
>
> LEDEV=# select cast(foo as integer) from test;
> ERROR: Cannot cast type 'character varying' to 'integer'
> LEDEV=# select cast(bar as integer) from test;
> bar
> -----
> 123
> (1 row)
Interesting. You can have an intermediate to-text cast:
select cast ( cast ( cast ('123' as varchar) as text) as integer);
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: joel@joelburton.com, scroyston@mac.com
Subject: Re: can't cast varchar as integer?
In-Reply-To: <JGEPJNMCKODMDHGOBKDNIEEICOAA.joel@joelburton.com>
* 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