On Mon, Aug 29, 2011 at 9:00 AM, Kevin Grittner
<Kevin.Grittner@wicourts.gov> wrote:
> Merlin Moncure <mmoncure@gmail.com> wrote:
>
>> yeah, that's the correct way, but why does this work?
>> select val from random() as val;
>
> If you look at the PostgreSQL reference docs for the SELECT
> statement, a from_item can be a SELECT statement in parentheses or a
> function call (among other things). =A0It cannot be an arbitrary
> expression containing operators (like ::).
right -- duh. I knew that...the canonical case for this is the
definition of pg_locks view. I've just never seen it used for a
regular scalar function. The whole thing is pretty peculiar IMO (but
useful occasionally).
merlin