summaryrefslogtreecommitdiff
path: root/sql/opt_sum.cc
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2017-05-23 11:09:47 +0300
committerMarko Mäkelä <marko.makela@mariadb.com>2017-05-23 11:09:47 +0300
commit8f643e2063c9890a353149f39ef85b2cf3151fd0 (patch)
treec5468b905c8858dc1cc80ccb2072a923b28c8783 /sql/opt_sum.cc
parent3aecedb2f8f99c446a5ba0b02efcf422a252c9e8 (diff)
parentb61700c22104b513caa9a85e5c6529aa5f2bf4e4 (diff)
downloadmariadb-git-8f643e2063c9890a353149f39ef85b2cf3151fd0.tar.gz
Merge 10.1 into 10.2
Diffstat (limited to 'sql/opt_sum.cc')
-rw-r--r--sql/opt_sum.cc9
1 files changed, 9 insertions, 0 deletions
diff --git a/sql/opt_sum.cc b/sql/opt_sum.cc
index cb1a705ad0c..ab587b8b279 100644
--- a/sql/opt_sum.cc
+++ b/sql/opt_sum.cc
@@ -254,6 +254,8 @@ int opt_sum_query(THD *thd,
int error= 0;
DBUG_ENTER("opt_sum_query");
+ thd->lex->current_select->min_max_opt_list.empty();
+
if (conds)
where_tables= conds->used_tables();
@@ -447,7 +449,14 @@ int opt_sum_query(THD *thd,
item_sum->aggregator_clear();
}
else
+ {
item_sum->reset_and_add();
+ /*
+ Save a reference to the item for possible rollback
+ of the min/max optimizations for this select
+ */
+ thd->lex->current_select->min_max_opt_list.push_back(item_sum);
+ }
item_sum->make_const();
recalc_const_item= 1;
break;