summaryrefslogtreecommitdiff
path: root/sql/sql_window.cc
diff options
context:
space:
mode:
Diffstat (limited to 'sql/sql_window.cc')
-rw-r--r--sql/sql_window.cc6
1 files changed, 6 insertions, 0 deletions
diff --git a/sql/sql_window.cc b/sql/sql_window.cc
index 37095ad78ca..2bdac89f293 100644
--- a/sql/sql_window.cc
+++ b/sql/sql_window.cc
@@ -2840,6 +2840,12 @@ bool Window_funcs_computation::setup(THD *thd,
order_window_funcs_by_window_specs(window_funcs);
SQL_SELECT *sel= NULL;
+ /*
+ If the tmp table is filtered during sorting
+ (ex: SELECT with HAVING && ORDER BY), we must make sure to keep the
+ filtering conditions when we perform sorting for window function
+ computation.
+ */
if (tab->filesort && tab->filesort->select)
{
sel= tab->filesort->select;