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.cc8
1 files changed, 6 insertions, 2 deletions
diff --git a/sql/sql_window.cc b/sql/sql_window.cc
index 1a111e52c75..a2fada64a83 100644
--- a/sql/sql_window.cc
+++ b/sql/sql_window.cc
@@ -2205,10 +2205,14 @@ void add_special_frame_cursors(THD *thd, Cursor_manager *cursor_manager,
cursor_manager->add_cursor(bottom_bound);
cursor_manager->add_cursor(top_bound);
DBUG_ASSERT(item_sum->fixed);
+ Item *int_item= new (thd->mem_root) Item_int(thd, 1);
+ Item *offset_func= new (thd->mem_root)
+ Item_func_minus(thd, item_sum->get_arg(1),
+ int_item);
+ offset_func->fix_fields(thd, &offset_func);
fc= new Frame_positional_cursor(*top_bound,
*top_bound, *bottom_bound,
- *item_sum->get_arg(1),
- false);
+ *offset_func, false);
fc->add_sum_func(item_sum);
cursor_manager->add_cursor(fc);
break;