summaryrefslogtreecommitdiff
path: root/sql/sql_select.cc
diff options
context:
space:
mode:
authorGleb Shchepa <gshchepa@mysql.com>2009-01-28 22:48:41 +0400
committerGleb Shchepa <gshchepa@mysql.com>2009-01-28 22:48:41 +0400
commitb135bcabe50fecd1999023752351dedee832bf0f (patch)
treeb8702fe7843344105f23871d8949d50349166d12 /sql/sql_select.cc
parenta931ac090dd64bfac6b061b92fbd36d108aff62b (diff)
parent334e249f914359864996adaf54508ed7b40971e2 (diff)
downloadmariadb-git-b135bcabe50fecd1999023752351dedee832bf0f.tar.gz
automerge 5.0-bugteam --> 5.1-bugteam (bug 39069)
Diffstat (limited to 'sql/sql_select.cc')
-rw-r--r--sql/sql_select.cc5
1 files changed, 5 insertions, 0 deletions
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index 49cacbe9272..90a5c5c4c8b 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -1676,8 +1676,13 @@ JOIN::exec()
We have to test for 'conds' here as the WHERE may not be constant
even if we don't have any tables for prepared statements or if
conds uses something like 'rand()'.
+ If the HAVING clause is either impossible or always true, then
+ JOIN::having is set to NULL by optimize_cond.
+ In this case JOIN::exec must check for JOIN::having_value, in the
+ same way it checks for JOIN::cond_value.
*/
if (cond_value != Item::COND_FALSE &&
+ having_value != Item::COND_FALSE &&
(!conds || conds->val_int()) &&
(!having || having->val_int()))
{