diff options
author | Sergei Golubchik <serg@mariadb.org> | 2017-07-18 14:59:10 +0200 |
---|---|---|
committer | Sergei Golubchik <serg@mariadb.org> | 2017-07-18 14:59:10 +0200 |
commit | 9a5fe1f4ea53f26690bfe2cd4f42050bfccaf4af (patch) | |
tree | 5456add57977533b445a03d2e03e87ffa7f483d8 /sql/sql_union.cc | |
parent | e7fd6ed3875bd91dbd30a62291ae471c35da8fdf (diff) | |
parent | 34cd74e52185de2ea3156e8295de3c638cde8c88 (diff) | |
download | mariadb-git-9a5fe1f4ea53f26690bfe2cd4f42050bfccaf4af.tar.gz |
Merge remote-tracking branch 'mysql/5.5' into 5.5
Diffstat (limited to 'sql/sql_union.cc')
-rw-r--r-- | sql/sql_union.cc | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/sql/sql_union.cc b/sql/sql_union.cc index 95ce1c9b940..2d816e0309d 100644 --- a/sql/sql_union.cc +++ b/sql/sql_union.cc @@ -1,5 +1,5 @@ -/* Copyright (c) 2000, 2014, Oracle and/or its affiliates. - Copyright (c) 2010, 2014, SkySQL Ab. +/* Copyright (c) 2000, 2017, Oracle and/or its affiliates. + Copyright (c) 2010, 2017, Corporation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -362,6 +362,19 @@ bool st_select_lex_unit::prepare(THD *thd_arg, select_result *sel_result, Item *item_tmp; while ((item_tmp= it++)) { + /* + If the outer query has a GROUP BY clause, an outer reference to this + query block may have been wrapped in a Item_outer_ref, which has not + been fixed yet. An Item_type_holder must be created based on a fixed + Item, so use the inner Item instead. + */ + DBUG_ASSERT(item_tmp->fixed || + (item_tmp->type() == Item::REF_ITEM && + ((Item_ref *)(item_tmp))->ref_type() == + Item_ref::OUTER_REF)); + if (!item_tmp->fixed) + item_tmp= item_tmp->real_item(); + /* Error's in 'new' will be detected after loop */ types.push_back(new Item_type_holder(thd_arg, item_tmp)); } @@ -1070,4 +1083,3 @@ void st_select_lex_unit::set_unique_exclude() } } } - |