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

From Tom Lane
Subject Re: WIP patch for LATERAL subqueries
Date
Msg-id 10794.1344266738@sss.pgh.pa.us
Whole thread Raw
In response to Re: WIP patch for LATERAL subqueries  (Robert Haas <robertmhaas@gmail.com>)
List pgsql-hackers
Robert Haas <robertmhaas@gmail.com> writes:
> On Mon, Aug 6, 2012 at 11:09 AM, Tom Lane <tgl@sss.pgh.pa.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


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: tzdata2012d
Next
From: Matthias
Date:
Subject: Fwd: Statistics and selectivity estimation for ranges