Re: lateral function as a subquery - WIP patch

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Antonin Houska <antonin(dot)houska(at)gmail(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: lateral function as a subquery - WIP patch
Date: 2012-03-10 12:56:20
Message-ID: CA+TgmoZMMxnyVXNPEu_Eso9DLeTu0VK5P5DnqLA2VfaA1fTtzA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sat, Mar 10, 2012 at 4:16 AM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> Robert Haas <robertmhaas(at)gmail(dot)com> writes:
>> On Fri, Mar 9, 2012 at 8:15 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)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.

True. I just meant that no join filter was implied.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2012-03-10 13:06:18 Re: [v9.2] Add GUC sepgsql.client_label
Previous Message Pavel Stehule 2012-03-10 12:35:12 Re: poll: CHECK TRIGGER?