On 08/05/2012 05:58 PM, Tom Lane wrote:
I've been idly amusing myself by trying to hack up support for
SQL-standard LATERAL subqueries.  I've got something that turns over,
more or less:


Awesome!!


Currently the patch only implements the syntax called out in the standard,
namely that you can put LATERAL in front of a <derived table>, which is
to say a parenthesized sub-SELECT in FROM.  It strikes me that it might be
worth allowing LATERAL with a function-in-FROM as well.  So basically
        LATERAL func(args) <alias>
would be an allowed abbreviation for
        LATERAL (SELECT * FROM func(args)) <alias>
Since the standard doesn't have function-in-FROM, it has nothing to say
about whether this is sane or not.  The argument for this is mainly that
SRFs are one of the main use-cases for LATERAL (replacing SRF-in-the-
SELECT-list usages), so we might as well make it convenient.  Any opinions
pro or con about that?


Pro. As you say this is the main use case, and the longer syntax just seems unnecessary fluff.

I'll comment on the rest of you email later, but this is just great news. Hardly a month goes by that I don't wish for LATERAL.


cheers

andrew

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

Reply via email to