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 9549.1331342158@sss.pgh.pa.us
Whole thread Raw
In response to lateral function as a subquery - WIP patch  (Antonin Houska <antonin.houska@gmail.com>)
Responses Re: lateral function as a subquery - WIP patch  (Robert Haas <robertmhaas@gmail.com>)
Re: lateral function as a subquery - WIP patch  (Antonin Houska <antonin.houska@gmail.com>)
List pgsql-hackers
Antonin Houska <antonin.houska@gmail.com> writes:
> For example:

> SELECT *
> FROM  a, b, func(a.i, b.j) as c, d
> WHERE a.i=b.j and b.j = d.k and c>1

> may become

> SELECT *
> FROM  a, b, <subquery> as c, d
> WHERE a.i=b.j and b.j = d.k and c>1

> where <subquery> is

> SELECT func(a.i, b.j)
> FROM a,b
> WHERE a.i=b.j

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.)
        regards, tom lane


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: poll: CHECK TRIGGER?
Next
From: Shigeru Hanada
Date:
Subject: Re: missing description initdb manual