summaryrefslogtreecommitdiff
path: root/sql/item.cc
diff options
context:
space:
mode:
authorSergei Golubchik <sergii@pisem.net>2014-05-09 12:35:11 +0200
committerSergei Golubchik <sergii@pisem.net>2014-05-09 12:35:11 +0200
commitd3e2e1243bb0dae95ce35b0380dd4f8f476b254d (patch)
tree8779ad6b2059f181770cc07e2437925d7d5d5d04 /sql/item.cc
parent229dad1f9b12f8e9f64b6a605bdf8e31c339d018 (diff)
parent124428a9e28e59f98b25d8ee07b57d264f63cbe4 (diff)
downloadmariadb-git-d3e2e1243bb0dae95ce35b0380dd4f8f476b254d.tar.gz
5.5 merge
Diffstat (limited to 'sql/item.cc')
-rw-r--r--sql/item.cc26
1 files changed, 19 insertions, 7 deletions
diff --git a/sql/item.cc b/sql/item.cc
index 58131e1eaea..2c963322eb6 100644
--- a/sql/item.cc
+++ b/sql/item.cc
@@ -4742,6 +4742,10 @@ bool is_outer_table(TABLE_LIST *table, SELECT_LEX *select)
DBUG_ASSERT(table->select_lex != select);
TABLE_LIST *tl;
+ if (table->belong_to_view &&
+ table->belong_to_view->select_lex == select)
+ return FALSE;
+
for (tl= select->master_unit()->derived;
tl && tl->is_merged_derived();
select= tl->select_lex, tl= select->master_unit()->derived)
@@ -5318,15 +5322,23 @@ mark_non_agg_field:
/*
Mark selects according to presence of non aggregated fields.
Fields from outer selects added to the aggregate function
- outer_fields list as its unknown at the moment whether it's
+ outer_fields list as it's unknown at the moment whether it's
aggregated or not.
- We're using either the select lex of the cached table (if present)
- or the field's resolution context. context->select_lex is
- safe for use because it's either the SELECT we want to use
- (the current level) or a stub added by non-SELECT queries.
+ We're using the select lex of the cached table (if present).
*/
- SELECT_LEX *select_lex= cached_table ?
- cached_table->select_lex : field->table->pos_in_table_list->select_lex;
+ SELECT_LEX *select_lex;
+ if (cached_table)
+ select_lex= cached_table->select_lex;
+ else if (!(select_lex= field->table->pos_in_table_list->select_lex))
+ {
+ /*
+ This can only happen when there is no real table in the query.
+ We are using the field's resolution context. context->select_lex is eee
+ safe for use because it's either the SELECT we want to use
+ (the current level) or a stub added by non-SELECT queries.
+ */
+ select_lex= context->select_lex;
+ }
if (!thd->lex->in_sum_func)
select_lex->set_non_agg_field_used(true);
else