diff options
author | Vicențiu Ciorbaru <vicentiu@mariadb.org> | 2017-07-25 00:41:54 +0300 |
---|---|---|
committer | Vicențiu Ciorbaru <vicentiu@mariadb.org> | 2017-07-25 00:41:54 +0300 |
commit | 786ad0a158f92eae0d65b02f34e864a7bbd8390e (patch) | |
tree | 8b796ce3ce81ab3c1f73e6eb5c594c74619810c0 /sql/sql_union.cc | |
parent | 2ce3f95151a424f950be40140c45b0ba583e07ab (diff) | |
parent | c8a0244e957bc4beff453f09c881bb51752d682c (diff) | |
download | mariadb-git-786ad0a158f92eae0d65b02f34e864a7bbd8390e.tar.gz |
Merge remote-tracking branch 'origin/5.5' into 10.0
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 cfa907b9ddc..16de451211f 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 @@ -360,6 +360,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)); } @@ -1076,4 +1089,3 @@ void st_select_lex_unit::set_unique_exclude() } } } - |