diff options
author | unknown <sanja@askmonty.org> | 2010-08-09 13:00:58 +0300 |
---|---|---|
committer | unknown <sanja@askmonty.org> | 2010-08-09 13:00:58 +0300 |
commit | 4cf6b18b03ffa4ca95486f0274b3692873c3901e (patch) | |
tree | 29877cf655c45d8f46d8b9f6488e5cdcdb902561 /sql/sql_expression_cache.cc | |
parent | 26148735a00d6ce6445d44123e7a2156c55f4729 (diff) | |
download | mariadb-git-4cf6b18b03ffa4ca95486f0274b3692873c3901e.tar.gz |
Fix for LP bug#611625: Removing NULL references from subquery parameter list added.
Incorrect limitation on number of parameters removed.
mysql-test/r/subselect_cache.result:
Test suite added.
mysql-test/t/subselect_cache.test:
Test suite added.
sql/sql_class.h:
Iterator changed.
sql/sql_expression_cache.cc:
Incorrect limitation removed.
Removing NULL references from subquery parameter list added.
Diffstat (limited to 'sql/sql_expression_cache.cc')
-rw-r--r-- | sql/sql_expression_cache.cc | 34 |
1 files changed, 22 insertions, 12 deletions
diff --git a/sql/sql_expression_cache.cc b/sql/sql_expression_cache.cc index 924abb24480..9596ca87bab 100644 --- a/sql/sql_expression_cache.cc +++ b/sql/sql_expression_cache.cc @@ -96,21 +96,38 @@ static uint field_enumerator(uchar *arg) void Expression_cache_tmptable::init() { - List_iterator_fast<Item*> li(*list); + List_iterator<Item*> li(*list); Item_iterator_ref_list it(li); Item **item; uint field_counter; DBUG_ENTER("Expression_cache_tmptable::init"); DBUG_ASSERT(!inited); inited= TRUE; + cache_table= NULL; - if (!(ULONGLONG_MAX >> (list->elements + 1))) + while ((item= li++)) { - DBUG_PRINT("info", ("Too many dependencies")); - DBUG_VOID_RETURN; + DBUG_ASSERT(item); + if (*item) + { + DBUG_ASSERT((*item)->fixed); + items.push_back((*item)); + } + else + { + /* + This is possible when optimizer already executed this subquery and + optimized out the condition predicate. + */ + li.remove(); + } } - cache_table= NULL; + if (list->elements == 0) + { + DBUG_PRINT("info", ("All parameters were removed by optimizer.")); + DBUG_VOID_RETURN; + } cache_table_param.init(); /* dependent items and result */ @@ -119,13 +136,6 @@ void Expression_cache_tmptable::init() cache_table_param.skip_create_table= 1; cache_table= NULL; - while ((item= li++)) - { - DBUG_ASSERT(item); - DBUG_ASSERT(*item); - DBUG_ASSERT((*item)->fixed); - items.push_back((*item)); - } items.push_front(val); if (!(cache_table= create_tmp_table(table_thd, &cache_table_param, |