the '::' cast doesn't work in the FROM clause - Mailing list pgsql-bugs

From Alexey Klyukin
Subject the '::' cast doesn't work in the FROM clause
Date
Msg-id 44B95360-DA92-48F5-AB6D-4B17FE31FC65@commandprompt.com
Whole thread Raw
List pgsql-bugs
Hello,

The following statement produces an error message in PostgreSQL 8.4 - 9.2 (=
head):

postgres=3D# select val from random()::integer as val;
ERROR:  syntax error at or near "::"
LINE 1: select val from random()::integer as val;

The same statement rewritten with CAST AS works as expected:
                                ^
postgres=3D# select val from CAST(random() as integer) as val;
 val
-----
   1
(1 row)

The '::' cast works normally when used in a target list:

postgres=3D# select random()::integer as val;
val
--------
      1
(1 row)

The documentation says these casts are equivalent, so either that's wrong, =
or this is a bug.
The target OS is Mac OS X 10.7.1 with llvm-gcc-4.2 used as a compiler.

--
Alexey Klyukin        http://www.commandprompt.com
The PostgreSQL Company =96 Command Prompt, Inc.

pgsql-bugs by date:

Previous
From: Itagaki Takahiro
Date:
Subject: Re: pgbench -T isn't a hard cutoff.
Next
From: "Itagaki Takahiro"
Date:
Subject: BUG #6181: concat_ws() incompatibility with MySQL