Details
-
Task
-
Status: Open (View Workflow)
-
Major
-
Resolution: Unresolved
-
None
-
None
-
None
Description
A check in Item_ident::collect_outer_ref_processor ensures that we do not traverse into a different unit when collecting outer references. This nest_level_base pointer may need updating when we merge as subquery SELECT_LEX with a different nest_level_base into a SELECT_LEX.
Once we have merged subq_select into this SELECT_LEX, we need to walk into the subquery SELECT_LEX, correcting nest_level_base.
We also update Item_singlerow_subselect::select_transformer() for the same reason.
Item_subselect::get_cache_parameters calls Item::collect_outer_ref_processor. This processor only includes items that have the same nest_level_base as the enclosing unit. For this example
create table t1 (a int not null, b int not null); |
create table t2 (c int not null, d int not null); |
create table t3 (e int not null); |
select a from t1 where a in (select c from t2 where d >= some(select e from t3 where b=e)); |
t1.b, buried in the lowest level select has a different nest_base_level to the lowest level Item_subselect after transforms.
select t3.e from t3 where t1.b = t3.e and (t2.d) >= t3.e |
This results in an incorrect answer due to a missing subquery cache parameter.
Attachments
Issue Links
- is part of
-
MDEV-35673 Correlated subquery problems causing wrong results and server crash
-
- In Review
-