Re: WIP patch for LATERAL subqueries - Mailing list pgsql-hackers

From Andrew Dunstan
Subject Re: WIP patch for LATERAL subqueries
Date
Msg-id 501EFAA2.6070303@dunslane.net
Whole thread Raw
In response to WIP patch for LATERAL subqueries  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: WIP patch for LATERAL subqueries
List pgsql-hackers
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


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: WIP patch for LATERAL subqueries
Next
From: Nils Goroll
Date:
Subject: spinlock->pthread_mutex : real world results