Mac OSX, postgresql 7.2.1
what's the reasoning behind not being able to cast a varchar as
integer? this seems very weird to me:
LEDEV=# create table test (foo as varchar(5), bar as text);
ERROR: parser: parse error at or near "as"
LEDEV=# create table test (foo varchar(5), bar text);
CREATE
LEDEV=# insert into test (foo, bar) values ('123', '123');
INSERT 409490 1
LEDEV=# select * from test; foo | bar
-----+----- 123 | 123
(1 row)
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)