Re: lateral function as a subquery - WIP patch - Mailing list pgsql-hackers

From Tom Lane
Subject Re: lateral function as a subquery - WIP patch
Date
Msg-id 16178.1331370983@sss.pgh.pa.us
Whole thread Raw
In response to Re: lateral function as a subquery - WIP patch  (Robert Haas <robertmhaas@gmail.com>)
Responses Re: lateral function as a subquery - WIP patch
List pgsql-hackers
Robert Haas <robertmhaas@gmail.com> writes:
> On Fri, Mar 9, 2012 at 8:15 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> Um ... how do you get the subquery result rows to join to only the
>> correct rows of the other tables? �This looks like an unconstrained join
>> to me, which is not what I believe the SQL spec for LATERAL to be, and
>> it doesn't seem especially useful either. �(If a subquery could do what
>> people wanted, we'd not be hearing all the requests for LATERAL.)

> I think LATERAL is intended as more or less an unconstrained nested
> loop with the lateral expression on the inner side, parameterized by
> value from the outer side.  Typically it's a SRF.

Um ... if it's parameterized by values from a "current row" of the outer
side, then it's not an unconstrained join.  That would be like doing an
inner indexscan join and producing a cross-join result.
        regards, tom lane


pgsql-hackers by date:

Previous
From: Pavel Stehule
Date:
Subject: Re: poll: CHECK TRIGGER?
Next
From: Yeb Havinga
Date:
Subject: Re: [v9.2] Add GUC sepgsql.client_label