Commit 5ecad03d authored by Sergey Petrunya's avatar Sergey Petrunya

MWL#17: Table elimination

- When collecting Item_subselect::refers_to, put references to the correct
  subselect entry.
parent 7b3d4645
...@@ -1780,6 +1780,7 @@ void st_select_lex_unit::exclude_tree() ...@@ -1780,6 +1780,7 @@ void st_select_lex_unit::exclude_tree()
void st_select_lex::mark_as_dependent(st_select_lex *last, Item *dependency) void st_select_lex::mark_as_dependent(st_select_lex *last, Item *dependency)
{ {
SELECT_LEX *next_to_last;
/* /*
Mark all selects from resolved to 1 before select where was Mark all selects from resolved to 1 before select where was
found table as depended (of select where was found table) found table as depended (of select where was found table)
...@@ -1787,6 +1788,7 @@ void st_select_lex::mark_as_dependent(st_select_lex *last, Item *dependency) ...@@ -1787,6 +1788,7 @@ void st_select_lex::mark_as_dependent(st_select_lex *last, Item *dependency)
for (SELECT_LEX *s= this; for (SELECT_LEX *s= this;
s && s != last; s && s != last;
s= s->outer_select()) s= s->outer_select())
{
if (!(s->uncacheable & UNCACHEABLE_DEPENDENT)) if (!(s->uncacheable & UNCACHEABLE_DEPENDENT))
{ {
// Select is dependent of outer select // Select is dependent of outer select
...@@ -1802,10 +1804,12 @@ void st_select_lex::mark_as_dependent(st_select_lex *last, Item *dependency) ...@@ -1802,10 +1804,12 @@ void st_select_lex::mark_as_dependent(st_select_lex *last, Item *dependency)
sl->uncacheable|= UNCACHEABLE_UNITED; sl->uncacheable|= UNCACHEABLE_UNITED;
} }
} }
next_to_last= s;
}
is_correlated= TRUE; is_correlated= TRUE;
this->master_unit()->item->is_correlated= TRUE; this->master_unit()->item->is_correlated= TRUE;
if (dependency) if (dependency)
this->master_unit()->item->refers_to.push_back(dependency); next_to_last->master_unit()->item->refers_to.push_back(dependency);
} }
bool st_select_lex_node::set_braces(bool value) { return 1; } bool st_select_lex_node::set_braces(bool value) { return 1; }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment