diff options
author | Vicențiu Ciorbaru <vicentiu@mariadb.org> | 2016-09-24 15:25:00 +0200 |
---|---|---|
committer | Vicențiu Ciorbaru <vicentiu@mariadb.org> | 2016-09-24 15:25:00 +0200 |
commit | de2175e96aa71eee1c5598d5e345b6e52c1a3a1d (patch) | |
tree | 398ee7e5c428afcc2fc7817b9f91e87e141168b5 /sql/sql_window.cc | |
parent | 45faae60b7c343e29b30d3c3ae67c9a2b964c579 (diff) | |
download | mariadb-git-de2175e96aa71eee1c5598d5e345b6e52c1a3a1d.tar.gz |
Window functions can have an empty over clause
Make sure we select one window function if we have an empty over clause.
Diffstat (limited to 'sql/sql_window.cc')
-rw-r--r-- | sql/sql_window.cc | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/sql/sql_window.cc b/sql/sql_window.cc index f66b390b318..8fed2418b82 100644 --- a/sql/sql_window.cc +++ b/sql/sql_window.cc @@ -2663,14 +2663,14 @@ bool Window_funcs_sort::setup(THD *thd, SQL_SELECT *sel, Window_spec *spec; Item_window_func *win_func= it.peek(); Item_window_func *win_func_with_longest_order= NULL; - uint longest_order_elements= 0; + int longest_order_elements= -1; /* The iterator should point to a valid function at the start of execution. */ DBUG_ASSERT(win_func); do { spec= win_func->window_spec; - uint win_func_order_elements= spec->partition_list->elements + + int win_func_order_elements= spec->partition_list->elements + spec->order_list->elements; if (win_func_order_elements > longest_order_elements) { |