Received: from maia.hub.org (maia-5.hub.org [200.46.204.29]) by mail.postgresql.org (Postfix) with ESMTP id 75D66B5DC38 for ; Mon, 29 Aug 2011 11:11:33 -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 16811-04 for ; Mon, 29 Aug 2011 14:11:27 +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 3E28CB5DC37 for ; Mon, 29 Aug 2011 11:11:27 -0300 (ADT) Received: from localhost (localhost [127.0.0.1]) by spinlock.commandprompt.com (Postfix) with ESMTP id 2B098348068; Mon, 29 Aug 2011 07:11:27 -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 WIlHcotZ9Z6j; Mon, 29 Aug 2011 07:11:24 -0700 (PDT) Received: from [10.0.10.10] (unknown [88.135.117.31]) by spinlock.commandprompt.com (Postfix) with ESMTPSA id 6D34434804A; Mon, 29 Aug 2011 07:11:23 -0700 (PDT) Subject: Re: the '::' cast doesn't work in the FROM clause Mime-Version: 1.0 (Apple Message framework v1244.3) Content-Type: text/plain; charset=windows-1252 From: Alexey Klyukin In-Reply-To: <4E5B55C102000025000407F1@gw.wicourts.gov> Date: Mon, 29 Aug 2011 17:11:20 +0300 Cc: pgsql-bugs@postgresql.org Content-Transfer-Encoding: quoted-printable Message-Id: <1804685E-C378-49E1-B12C-96078B221102@commandprompt.com> References: <4E5B449602000025000407D9@gw.wicourts.gov> <7B691F0D-A0E3-4195-98E7-F0C5833A2B74@commandprompt.com> <4E5B55C102000025000407F1@gw.wicourts.gov> To: Kevin Grittner 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/172 X-Sequence-Number: 30984 On Aug 29, 2011, at 5:02 PM, Kevin Grittner wrote: > Alexey Klyukin wrote: >=20 >> Function calls can appear in the FROM clause. (This is especially >> useful for functions that return result sets, but any function can >> be used.) This acts as though its output were created as a >> temporary table for the duration of this single SELECT command. >=20 > It doesn't say that operators which provide equivalent functionality > to functions can also be used. I agree, but why is it possible to use the type casting with CAST there? = Doesn't this break the promise of equivalency between the 'CAST .. ' and = '::'? select val from CAST(random() as integer) as val; val=20 ----- 1 (1 row) -- Alexey Klyukin http://www.commandprompt.com The PostgreSQL Company =96 Command Prompt, Inc.