summaryrefslogtreecommitdiff
path: root/sql/sql_select.cc
diff options
context:
space:
mode:
Diffstat (limited to 'sql/sql_select.cc')
-rw-r--r--sql/sql_select.cc5
1 files changed, 3 insertions, 2 deletions
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index 02ec7ae08ed..74a9fc573c4 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -290,8 +290,6 @@ JOIN::prepare(Item ***rref_pointer_array,
select_lex->having_fix_field= 0;
if (having_fix_rc || thd->net.report_error)
DBUG_RETURN(-1); /* purecov: inspected */
- if (having->with_sum_func)
- having->split_sum_func2(thd, ref_pointer_array, all_fields, &having);
}
// Is it subselect
@@ -306,6 +304,9 @@ JOIN::prepare(Item ***rref_pointer_array,
}
}
+ if (having && having->with_sum_func)
+ having->split_sum_func2(thd, ref_pointer_array, all_fields, &having);
+
if (setup_ftfuncs(select_lex)) /* should be after having->fix_fields */
DBUG_RETURN(-1);