Received: from maia.hub.org (maia-5.hub.org [200.46.204.29]) by mail.postgresql.org (Postfix) with ESMTP id 2CB95B5DCBF for ; Mon, 29 Aug 2011 08:21:11 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.29]) (amavisd-maia, port 10024) with ESMTP id 72472-01 for ; Mon, 29 Aug 2011 11:21:04 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from spinlock.commandprompt.com (host-215.commandprompt.net [207.173.203.215]) by mail.postgresql.org (Postfix) with ESMTP id 689EDB5DCB7 for ; Mon, 29 Aug 2011 08:21:03 -0300 (ADT) Received: from localhost (localhost [127.0.0.1]) by spinlock.commandprompt.com (Postfix) with ESMTP id 7314A348068 for ; Mon, 29 Aug 2011 04:21:03 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at commandprompt.com Received: from spinlock.commandprompt.com ([127.0.0.1]) by localhost (spinlock.commandprompt.com.commandprompt.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id AJzr6dXPXei8 for ; Mon, 29 Aug 2011 04:21:00 -0700 (PDT) Received: from [10.0.10.10] (unknown [88.135.117.31]) by spinlock.commandprompt.com (Postfix) with ESMTPSA id 58FDA348046 for ; Mon, 29 Aug 2011 04:21:00 -0700 (PDT) From: Alexey Klyukin Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable 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> To: pgsql-bugs@postgresql.org Mime-Version: 1.0 (Apple Message framework v1244.3) X-Mailer: Apple Mail (2.1244.3) X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.9 tagged_above=-5 required=5 tests=BAYES_00=-1.9 X-Spam-Level: X-Archive-Number: 201108/165 X-Sequence-Number: 30977 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.