Re: Reference to parent query from ANY sublink - Mailing list pgsql-hackers

From Antonin Houska
Subject Re: Reference to parent query from ANY sublink
Date
Msg-id 5272BF7A.2000206@gmail.com
Whole thread Raw
In response to Reference to parent query from ANY sublink  (Antonin Houska <antonin.houska@gmail.com>)
Responses Re: Reference to parent query from ANY sublink  (Antonin Houska <antonin.houska@gmail.com>)
List pgsql-hackers
On 10/31/2013 03:46 PM, Antonin Houska wrote:
> Can the change be as simple as this or do I neglect anything?

Well, the example of outer join is wrong. Instead I think query

SELECT *
FROM    tab1 aLEFT JOINtab1 bON b.i = ANY (    SELECT  tab2.k    FROM    tab2    WHERE    k = a.j);


should be converted to

SELECT  *
FROM    tab1 aLEFT JOIN(  tab1 b   LATERAL SEMI JOIN   (  SELECT  tab2.k      FROM    tab2      WHERE    k = a.j   ) AS
ANY_subquery  ON b.i = sub.k)
 
I'm not sure if it's legal for the WHERE clause to reference LHS of the
original outer join (a.j). Some more restriction may be needed. I need
to think about it a bit more.

// Tony




pgsql-hackers by date:

Previous
From: Kevin Grittner
Date:
Subject: Re: Feature request: Optimizer improvement
Next
From: Joe Love
Date:
Subject: Feature request: optimizer improvement