diff options
author | Oleksandr Byelkin <sanja@mariadb.com> | 2017-07-03 13:35:32 +0200 |
---|---|---|
committer | Oleksandr Byelkin <sanja@mariadb.com> | 2017-07-05 09:07:50 +0200 |
commit | a7ed4644a6f3e38dbad3658fc35890ce31cc0749 (patch) | |
tree | 3c581a34d04a72ca8103f06cd6e07dbd47cc24ff /sql/item.cc | |
parent | 23ac2dd2a4c5f281479980d0156a2ccebab510b2 (diff) | |
download | mariadb-git-a7ed4644a6f3e38dbad3658fc35890ce31cc0749.tar.gz |
MDEV-10146: Wrong result (or questionable result and behavior) with aggregate function in uncorrelated SELECT subquery
When outer reference resolved in a VIEW it still should mark aggregate function resolving border.
Diffstat (limited to 'sql/item.cc')
-rw-r--r-- | sql/item.cc | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/sql/item.cc b/sql/item.cc index 1df91dc2534..68411860274 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -5045,6 +5045,13 @@ Item_field::fix_outer_field(THD *thd, Field **from_field, Item **reference) ((ref_type == REF_ITEM || ref_type == FIELD_ITEM) ? (Item_ident*) (*reference) : 0)); + if (thd->lex->in_sum_func && + thd->lex->in_sum_func->nest_level >= select->nest_level) + { + Item::Type ref_type= (*reference)->type(); + set_if_bigger(thd->lex->in_sum_func->max_arg_level, + select->nest_level); + } /* A reference to a view field had been found and we substituted it instead of this Item (find_field_in_tables |