Re: WIP patch for LATERAL subqueries

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Amit Kapila <amit(dot)kapila(at)huawei(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: WIP patch for LATERAL subqueries
Date: 2012-08-06 15:25:38
Message-ID: 10794.1344266738@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Robert Haas <robertmhaas(at)gmail(dot)com> writes:
> On Mon, Aug 6, 2012 at 11:09 AM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>> Uh, what exactly? AFAICT from that blog entry, "x OUTER APPLY y" is
>> exactly the same as "x LEFT JOIN LATERAL y ON true". Okay, so you
>> saved three words, but is that a good enough reason to invent a
>> nonstandard syntax?

> I wasn't sure that x LEFT JOIN LATERAL (SELECT * FROM y) ON true is
> valid syntax. I thought that perhaps LATERAL() was only allowed
> around a top-level FROM-list item.

No. LATERAL is allowed in a <table reference>, which can be either
a top-level FROM item or a component of a JOIN nest. (My current
patch doesn't actually work for the latter case, but I'm going to
work on fixing that next.) What's curious about that Sybase blog
is that the blogger seems to think that LATERAL can only be used
at top level ... but I'm not sure if that's actually a restriction
in Sybase, or just a gap in his knowledge.

regards, tom lane

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Matthias 2012-08-06 16:00:59 Re: Statistics and selectivity estimation for ranges
Previous Message Tom Lane 2012-08-06 15:18:45 Re: tzdata2012d