summaryrefslogtreecommitdiff
path: root/sql/opt_sum.cc
diff options
context:
space:
mode:
authorunknown <monty@mashka.mysql.fi>2003-02-08 01:12:58 +0200
committerunknown <monty@mashka.mysql.fi>2003-02-08 01:12:58 +0200
commitcb38070e9f4e3dcaf3e2f9dc42577802ba035085 (patch)
treed54b65dfc052978dab95842c84f1a39745ef0d0c /sql/opt_sum.cc
parent5dd528a2fda1412b8b75a6311dbc7262670983b6 (diff)
parent133ed0bf6ffde95d02ea35b6c02b5a042d73ecc0 (diff)
downloadmariadb-git-cb38070e9f4e3dcaf3e2f9dc42577802ba035085.tar.gz
merge
configure.in: Auto merged mysql-test/t/explain.test: Auto merged sql/ha_innodb.cc: Auto merged sql/item_create.cc: Auto merged sql/item_create.h: Auto merged sql/opt_range.cc: Auto merged sql/opt_sum.cc: Auto merged
Diffstat (limited to 'sql/opt_sum.cc')
-rw-r--r--sql/opt_sum.cc11
1 files changed, 9 insertions, 2 deletions
diff --git a/sql/opt_sum.cc b/sql/opt_sum.cc
index 2ca6ddbab10..d8c61fa1a1d 100644
--- a/sql/opt_sum.cc
+++ b/sql/opt_sum.cc
@@ -245,8 +245,15 @@ int opt_sum_query(TABLE_LIST *tables, List<Item> &all_fields,COND *conds)
const_result=0;
}
}
- if (used_tables != removed_tables)
- const_result=0; // We didn't remove all tables
+ /*
+ If we have a where clause, we can only ignore searching in the
+ tables if MIN/MAX optimisation replaced all used tables
+ This is to not to use replaced values in case of:
+ SELECT MIN(key) FROM table_1, empty_table
+ removed_tables is != 0 if we have used MIN() or MAX().
+ */
+ if (removed_tables && used_tables != removed_tables)
+ const_result= 0; // We didn't remove all tables
return const_result;
}