summaryrefslogtreecommitdiff
path: root/sql/sql_window.cc
diff options
context:
space:
mode:
authorIgor Babaev <igor@askmonty.org>2016-03-16 23:35:28 -0700
committerIgor Babaev <igor@askmonty.org>2016-03-16 23:35:28 -0700
commitc3ab9712b0bd30758abfca598c32e254b0e873be (patch)
tree7c0db1f676f45b7c46ef5b55d0f45ac4fb2db9a2 /sql/sql_window.cc
parent72a4969ecaddb7747e40a96b024fdbd374b81316 (diff)
downloadmariadb-git-c3ab9712b0bd30758abfca598c32e254b0e873be.tar.gz
Fixed the bug mdev-9719 concerning execution of prepared statements
with window functions. Added the test case for it. Also allowed to use aliases for set functions in partition and order lists that are specified in window functions.
Diffstat (limited to 'sql/sql_window.cc')
-rw-r--r--sql/sql_window.cc7
1 files changed, 6 insertions, 1 deletions
diff --git a/sql/sql_window.cc b/sql/sql_window.cc
index 8c9b77b9392..f09241c3ff4 100644
--- a/sql/sql_window.cc
+++ b/sql/sql_window.cc
@@ -79,7 +79,7 @@ Window_frame::check_frame_bounds()
int
setup_windows(THD *thd, Ref_ptr_array ref_pointer_array, TABLE_LIST *tables,
List<Item> &fields, List<Item> &all_fields,
- List<Window_spec> win_specs)
+ List<Window_spec> &win_specs)
{
Window_spec *win_spec;
DBUG_ENTER("setup_windows");
@@ -90,6 +90,8 @@ setup_windows(THD *thd, Ref_ptr_array ref_pointer_array, TABLE_LIST *tables,
We could have avoided it if we had built two separate lists for
named and unnamed specifications.
*/
+ Query_arena *arena, backup;
+ arena= thd->activate_stmt_arena_if_needed(&backup);
uint i = 0;
uint elems= win_specs.elements;
while ((win_spec= it++) && i++ < elems)
@@ -100,6 +102,9 @@ setup_windows(THD *thd, Ref_ptr_array ref_pointer_array, TABLE_LIST *tables,
win_specs.push_back(win_spec);
}
}
+ if (arena)
+ thd->restore_active_arena(arena, &backup);
+
it.rewind();
List_iterator_fast<Window_spec> itp(win_specs);