diff options
author | Michael Widenius <monty@askmonty.org> | 2011-05-16 15:07:04 +0300 |
---|---|---|
committer | Michael Widenius <monty@askmonty.org> | 2011-05-16 15:07:04 +0300 |
commit | 8543621fa0f4a3c4102ac8f799888ef79e2e1dcf (patch) | |
tree | 29e8f301ef929cfe1c00eec9dee265aa0acaa350 /sql/sql_union.cc | |
parent | f458e198c0bea67c6a3787738108bbfb139639bd (diff) | |
parent | bcee6652c6052cabd67f8d30c14e162235749d38 (diff) | |
download | mariadb-git-8543621fa0f4a3c4102ac8f799888ef79e2e1dcf.tar.gz |
Merge with 5.3 main
Diffstat (limited to 'sql/sql_union.cc')
-rw-r--r-- | sql/sql_union.cc | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/sql/sql_union.cc b/sql/sql_union.cc index 898df3dd65e..192ea31c610 100644 --- a/sql/sql_union.cc +++ b/sql/sql_union.cc @@ -192,6 +192,8 @@ st_select_lex_unit::init_prepare_fake_select_lex(THD *thd_arg) { (*order->item)->walk(&Item::change_context_processor, 0, (uchar*) &fake_select_lex->context); + (*order->item)->walk(&Item::set_fake_select_as_master_processor, 0, + (uchar*) fake_select_lex); } } @@ -276,6 +278,18 @@ bool st_select_lex_unit::prepare(THD *thd_arg, select_result *sel_result, can_skip_order_by= is_union_select && !(sl->braces && sl->explicit_limit); + /* + Remove all references from the select_lex_units to the subqueries that + are inside the ORDER BY clause. + */ + if (can_skip_order_by) + { + for (ORDER *ord= (ORDER *)sl->order_list.first; ord; ord= ord->next) + { + (*ord->item)->walk(&Item::eliminate_subselect_processor, FALSE, NULL); + } + } + saved_error= join->prepare(&sl->ref_pointer_array, sl->table_list.first, sl->with_wild, |