diff options
author | monty@mashka.mysql.fi <> | 2003-02-07 17:57:07 +0200 |
---|---|---|
committer | monty@mashka.mysql.fi <> | 2003-02-07 17:57:07 +0200 |
commit | 1b9b042654512c7013fceb135795fc4453011033 (patch) | |
tree | 47bb4c4c761190424e909ac9f98674ad71c80b6d /sql/opt_sum.cc | |
parent | f68914addb4a59927cbc47c8d3a2431b5b180770 (diff) | |
download | mariadb-git-1b9b042654512c7013fceb135795fc4453011033.tar.gz |
Fix problem in MIN/MAX optimisation (from last patch)
Don't make OLD_PASSWORD() a reserved word
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; } |