Alexey Klyukin  wrote:
 
> The following statement produces an error message in PostgreSQL 8.4
> - 9.2 (head):
> 
> postgres=# select val from random()::integer as val;
 
> The same statement rewritten with CAST AS works as expected:
> 
> postgres=# select val from CAST(random() as integer) as val;
 
> The documentation says these casts are equivalent, so either that's
> wrong, or this is a bug.
 
Please point out where you think the documentation says that.  The
way I read it, this is the correct syntax:
 
test=# select val from (select random()::integer) as x(val);
 val 
-----
   1
(1 row)
 
Not only are you missing required parentheses and the SELECT keyword,
you're returning a record rather than a scalar value.
 
-Kevin

-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs

Reply via email to