Re: WIP patch for LATERAL subqueries

From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-hackers(at)postgreSQL(dot)org
Subject: Re: WIP patch for LATERAL subqueries
Date: 2012-08-05 22:58:42
Message-ID: 501EFAA2.6070303@dunslane.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Nils Goroll 2012-08-05 23:19:27 spinlock->pthread_mutex : real world results
Previous Message Tom Lane 2012-08-05 21:58:07 WIP patch for LATERAL subqueries