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 a
LEFT JOIN
tab1 b
ON b.i = ANY (
SELECT tab2.k
FROM tab2
WHERE k = a.j);
should be converted to
SELECT *
FROM tab1 a
LEFT 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