summaryrefslogtreecommitdiff
path: root/sql/sql_lex.cc
diff options
context:
space:
mode:
authorSergey Petrunya <psergey@askmonty.org>2009-07-08 21:10:38 +0400
committerSergey Petrunya <psergey@askmonty.org>2009-07-08 21:10:38 +0400
commit5ecad03df9eef6e4d68cc7767b684944384e084e (patch)
tree0390e28c9c64db27fe5a6a62e4717eaec889be70 /sql/sql_lex.cc
parent7b3d46457879bdae3be97dc4ec6aea3bf96c6697 (diff)
downloadmariadb-git-5ecad03df9eef6e4d68cc7767b684944384e084e.tar.gz
MWL#17: Table elimination
- When collecting Item_subselect::refers_to, put references to the correct subselect entry.
Diffstat (limited to 'sql/sql_lex.cc')
-rw-r--r--sql/sql_lex.cc6
1 files changed, 5 insertions, 1 deletions
diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc
index dc8dadc971a..680a3851723 100644
--- a/sql/sql_lex.cc
+++ b/sql/sql_lex.cc
@@ -1780,6 +1780,7 @@ void st_select_lex_unit::exclude_tree()
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
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)
for (SELECT_LEX *s= this;
s && s != last;
s= s->outer_select())
+ {
if (!(s->uncacheable & UNCACHEABLE_DEPENDENT))
{
// Select is dependent of outer select
@@ -1802,10 +1804,12 @@ void st_select_lex::mark_as_dependent(st_select_lex *last, Item *dependency)
sl->uncacheable|= UNCACHEABLE_UNITED;
}
}
+ next_to_last= s;
+ }
is_correlated= TRUE;
this->master_unit()->item->is_correlated= TRUE;
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; }