diff options
author | unknown <monty@mashka.mysql.fi> | 2003-02-07 17:57:07 +0200 |
---|---|---|
committer | unknown <monty@mashka.mysql.fi> | 2003-02-07 17:57:07 +0200 |
commit | 5db7246f78d62f07433b3e623e20002536ff20b2 (patch) | |
tree | 47bb4c4c761190424e909ac9f98674ad71c80b6d /sql/opt_sum.cc | |
parent | f06b0d9f3cfeaee8098db22eeecf41f6c072c479 (diff) | |
download | mariadb-git-5db7246f78d62f07433b3e623e20002536ff20b2.tar.gz |
Fix problem in MIN/MAX optimisation (from last patch)
Don't make OLD_PASSWORD() a reserved word
mysql-test/r/explain.result:
Test select count(*)
mysql-test/r/func_crypt.result:
Test old_password()
mysql-test/t/explain.test:
Test select count(*)
mysql-test/t/func_crypt.test:
Test old_password()
sql/item_create.cc:
Don't make OLD_PASSWORD() a reserved word
sql/item_create.h:
Don't make OLD_PASSWORD() a reserved word
sql/lex.h:
Don't make OLD_PASSWORD() a reserved word
sql/opt_range.cc:
Remove blank space
sql/opt_sum.cc:
Fix problem in MIN/MAX optimisation
Diffstat (limited to 'sql/opt_sum.cc')
-rw-r--r-- | sql/opt_sum.cc | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/sql/opt_sum.cc b/sql/opt_sum.cc index d5a4149f243..41771646082 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; } |