summaryrefslogtreecommitdiff
path: root/sql/sql_lex.cc
diff options
context:
space:
mode:
authorSergei Golubchik <sergii@pisem.net>2012-08-22 16:45:25 +0200
committerSergei Golubchik <sergii@pisem.net>2012-08-22 16:45:25 +0200
commitf72a7659976089dc6f727bb31e8a91306199cf57 (patch)
tree0199cd1bf1c16b01b358ab88e5dce5b038349872 /sql/sql_lex.cc
parented06ba3492d55c9e9dde231b55352f854e5e4b50 (diff)
parent1fd8150a5b5e3f56aa3c253225929a07ee9a4026 (diff)
downloadmariadb-git-f72a7659976089dc6f727bb31e8a91306199cf57.tar.gz
5.2 merge.
two tests still fail: main.innodb_icp and main.range_vs_index_merge_innodb call records_in_range() with both range ends being open (which triggers an assert)
Diffstat (limited to 'sql/sql_lex.cc')
-rw-r--r--sql/sql_lex.cc23
1 files changed, 23 insertions, 0 deletions
diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc
index 8ebefa536ac..d6f23c28721 100644
--- a/sql/sql_lex.cc
+++ b/sql/sql_lex.cc
@@ -306,6 +306,8 @@ void lex_start(THD *thd)
lex->select_lex.sql_cache= SELECT_LEX::SQL_CACHE_UNSPECIFIED;
lex->select_lex.init_order();
lex->select_lex.group_list.empty();
+ if (lex->select_lex.group_list_ptrs)
+ lex->select_lex.group_list_ptrs->clear();
lex->describe= 0;
lex->subqueries= FALSE;
lex->context_analysis_only= 0;
@@ -1656,6 +1658,8 @@ void st_select_lex::init_select()
sj_nests.empty();
sj_subselects.empty();
group_list.empty();
+ if (group_list_ptrs)
+ group_list_ptrs->clear();
type= db= 0;
having= 0;
table_join_options= 0;
@@ -3002,6 +3006,8 @@ static void fix_prepare_info_in_table_list(THD *thd, TABLE_LIST *tbl)
The passed WHERE and HAVING are to be saved for the future executions.
This function saves it, and returns a copy which can be thrashed during
this execution of the statement. By saving/thrashing here we mean only
+ We also save the chain of ORDER::next in group_list, in case
+ the list is modified by remove_const().
AND/OR trees.
The function also calls fix_prepare_info_in_table_list that saves all
ON expressions.
@@ -3013,6 +3019,19 @@ void st_select_lex::fix_prepare_information(THD *thd, Item **conds,
if (!thd->stmt_arena->is_conventional() && first_execution)
{
first_execution= 0;
+ if (group_list.first)
+ {
+ if (!group_list_ptrs)
+ {
+ void *mem= thd->stmt_arena->alloc(sizeof(Group_list_ptrs));
+ group_list_ptrs= new (mem) Group_list_ptrs(thd->stmt_arena->mem_root);
+ }
+ group_list_ptrs->reserve(group_list.elements);
+ for (ORDER *order= group_list.first; order; order= order->next)
+ {
+ group_list_ptrs->push_back(order);
+ }
+ }
if (*conds)
{
thd->check_and_register_item_tree(&prep_where, conds);
@@ -3768,3 +3787,7 @@ bool st_lex::is_partition_management() const
(alter_info.flags == ALTER_ADD_PARTITION ||
alter_info.flags == ALTER_REORGANIZE_PARTITION));
}
+
+#ifdef HAVE_EXPLICIT_TEMPLATE_INSTANTIATION
+template class Mem_root_array<ORDER*, true>;
+#endif