summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2021-06-21 09:07:40 +0300
committerMarko Mäkelä <marko.makela@mariadb.com>2021-06-21 09:07:40 +0300
commitc9a85fb1b14d9944920ebdb3514c48ea57e1647d (patch)
tree922d11920b800072a90ebfba68ce23640500fb84 /sql
parent068246c006b8f691982194529a32bff7eb010694 (diff)
parent773a07b65517327add6348c045cee14bdf489fe0 (diff)
downloadmariadb-git-c9a85fb1b14d9944920ebdb3514c48ea57e1647d.tar.gz
Merge 10.2 into 10.3
Diffstat (limited to 'sql')
-rw-r--r--sql/event_scheduler.cc2
-rw-r--r--sql/item.cc1
-rw-r--r--sql/item_cmpfunc.cc3
-rw-r--r--sql/sql_select.cc10
4 files changed, 6 insertions, 10 deletions
diff --git a/sql/event_scheduler.cc b/sql/event_scheduler.cc
index 2ebe1f5bb69..f35485f9acf 100644
--- a/sql/event_scheduler.cc
+++ b/sql/event_scheduler.cc
@@ -434,7 +434,7 @@ Event_scheduler::start(int *err_no)
scheduler_thd= NULL;
deinit_event_thread(new_thd);
- delete scheduler_param_value;
+ my_free(scheduler_param_value);
ret= true;
}
diff --git a/sql/item.cc b/sql/item.cc
index d5a4b4363d3..f91705bfaff 100644
--- a/sql/item.cc
+++ b/sql/item.cc
@@ -8601,6 +8601,7 @@ Item_cache_wrapper::Item_cache_wrapper(THD *thd, Item *item_arg):
with_field= orig_item->with_field;
name= item_arg->name;
m_with_subquery= orig_item->with_subquery();
+ with_window_func= orig_item->with_window_func;
if ((expr_value= orig_item->get_cache(thd)))
expr_value->setup(thd, orig_item);
diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc
index 413c422eace..9ebd765f1b2 100644
--- a/sql/item_cmpfunc.cc
+++ b/sql/item_cmpfunc.cc
@@ -1359,6 +1359,9 @@ bool Item_in_optimizer::fix_fields(THD *thd, Item **ref)
maybe_null=1;
m_with_subquery= true;
with_sum_func= with_sum_func || args[1]->with_sum_func;
+ with_window_func= args[0]->with_window_func;
+ // The subquery cannot have window functions aggregated in this select
+ DBUG_ASSERT(!args[1]->with_window_func);
with_field= with_field || args[1]->with_field;
with_param= args[0]->with_param || args[1]->with_param;
used_tables_and_const_cache_join(args[1]);
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index 7f4c6d24b8d..7a97ae5294f 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -4500,7 +4500,7 @@ make_join_statistics(JOIN *join, List<TABLE_LIST> &tables_list,
int error= 0;
TABLE *UNINIT_VAR(table); /* inited in all loops */
uint i,table_count,const_count,key;
- table_map found_const_table_map, all_table_map, found_ref, refs;
+ table_map found_const_table_map, all_table_map;
key_map const_ref, eq_part;
bool has_expensive_keyparts;
TABLE **table_vector;
@@ -4763,7 +4763,6 @@ make_join_statistics(JOIN *join, List<TABLE_LIST> &tables_list,
{
ref_changed = 0;
more_const_tables_found:
- found_ref=0;
/*
We only have to loop from stat_vector + const_count as
@@ -4853,7 +4852,6 @@ make_join_statistics(JOIN *join, List<TABLE_LIST> &tables_list,
key=keyuse->key;
s->keys.set_bit(key); // TODO: remove this ?
- refs=0;
const_ref.clear_all();
eq_part.clear_all();
has_expensive_keyparts= false;
@@ -4869,8 +4867,6 @@ make_join_statistics(JOIN *join, List<TABLE_LIST> &tables_list,
if (keyuse->val->is_expensive())
has_expensive_keyparts= true;
}
- else
- refs|=keyuse->used_tables;
eq_part.set_bit(keyuse->keypart);
}
keyuse++;
@@ -4922,8 +4918,6 @@ make_join_statistics(JOIN *join, List<TABLE_LIST> &tables_list,
found_const_table_map|= table->map;
break;
}
- else
- found_ref|= refs; // Table is const if all refs are const
}
else if (base_const_ref == base_eq_part)
s->const_keys.set_bit(key);
@@ -27248,7 +27242,6 @@ static bool get_range_limit_read_cost(const JOIN_TAB *tab,
*/
if (tab)
{
- key_part_map const_parts= 0;
key_part_map map= 1;
uint kp;
/* Find how many key parts would be used by ref(const) */
@@ -27256,7 +27249,6 @@ static bool get_range_limit_read_cost(const JOIN_TAB *tab,
{
if (!(table->const_key_parts[keynr] & map))
break;
- const_parts |= map;
}
if (kp > 0)