From: Alexey Klyukin <alexk@commandprompt.com>
To: pgsql-bugs@postgresql.org
Subject: the '::' cast doesn't work in the FROM clause
Date: Mon, 29 Aug 2011 14:20:56 +0300
Message-ID: <44B95360-DA92-48F5-AB6D-4B17FE31FC65@commandprompt.com> (raw)
Hello,
The following statement produces an error message in PostgreSQL 8.4 - 9.2 (head):
postgres=# 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=# select val from CAST(random() as integer) as val;
val
-----
1
(1 row)
The '::' cast works normally when used in a target list:
postgres=# 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 – Command Prompt, Inc.
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 from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-bugs@postgresql.org
Cc: alexk@commandprompt.com
Subject: Re: the '::' cast doesn't work in the FROM clause
In-Reply-To: <44B95360-DA92-48F5-AB6D-4B17FE31FC65@commandprompt.com>
References: <44B95360-DA92-48F5-AB6D-4B17FE31FC65@commandprompt.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