Commit 3b11e4f8 authored by unknown's avatar unknown

Fixed LP bug #609121

Post-review fix - avoid re-evaluation of the having clause
when it evaluates to true.
parent a09e5f50
...@@ -12651,12 +12651,15 @@ do_select(JOIN *join,List<Item> *fields,TABLE *table,Procedure *procedure) ...@@ -12651,12 +12651,15 @@ do_select(JOIN *join,List<Item> *fields,TABLE *table,Procedure *procedure)
DBUG_ASSERT(join->examined_rows <= 1); DBUG_ASSERT(join->examined_rows <= 1);
} }
else if (join->send_row_on_empty_set()) else if (join->send_row_on_empty_set())
{
if (!join->having || join->having->val_int())
{ {
List<Item> *columns_list= (procedure ? &join->procedure_fields_list : List<Item> *columns_list= (procedure ? &join->procedure_fields_list :
fields); fields);
rc= join->result->send_data(*columns_list); rc= join->result->send_data(*columns_list);
} }
} }
}
else else
{ {
DBUG_ASSERT(join->tables); DBUG_ASSERT(join->tables);
......
...@@ -1722,8 +1722,7 @@ public: ...@@ -1722,8 +1722,7 @@ public:
bool send_row_on_empty_set() bool send_row_on_empty_set()
{ {
return (do_send_rows && tmp_table_param.sum_func_count != 0 && return (do_send_rows && tmp_table_param.sum_func_count != 0 &&
!group_list && having_value != Item::COND_FALSE && !group_list && having_value != Item::COND_FALSE);
(!having || having->val_int()));
} }
bool change_result(select_result *result); bool change_result(select_result *result);
bool is_top_level_join() const bool is_top_level_join() const
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment