maria-developers team mailing list archive
-
maria-developers team
-
Mailing list archive
-
Message #04235
Derived table nests not removed by simplify_joins?
Hello Igor,
I've discovered the following:
Consider a testcase for https://bugs.launchpad.net/maria/+bug/803365.
There we have a query that's using a derived table that's on the inner side
of an outer join:
SELECT *
FROM t1
WHERE t1.f1 IN (
SELECT t2.f2
FROM t2
LEFT JOIN (
SELECT *
FROM t3
) AS alias1
ON alias1.f3 = t2.f2
);
If I follow it in debugger to right after simplify_joins(), I can see this structure (the
[] brackets denote List<TABLE_LIST> bounds):
['t1'---'(sj-nest)']
|
['alias1'---'t2' ]
|
[t3]
'alias1' is on the inner side of an outer join (it has non-NULL on_expr, and outer_join==1).
It has got a single child, t3, which has on_expr==NULL and outer_join==0. Is it really correct
that simplify_joins() didn't remove 'alias1', like it does with regular join nests?
Could it be that simplify_joins() code can't handle single-child join nests just because the parser
never produced them (but after conversion of derived tables to join nests they are now possible?)
BR
Sergey
--
Sergey Petrunia, Software Developer
Monty Program AB, http://askmonty.org
Blog: http://s.petrunia.net/blog