From b0df247db675a721198f2d4dbeb098cd57d932a3 Mon Sep 17 00:00:00 2001 From: Varun Gupta Date: Fri, 10 Jul 2020 10:45:04 +0530 Subject: MDEV-22463: Element_type &Bounds_checked_array::operator[](size_t) [Element_type = Item *]: Assertion `n < m_size' failed. Allocate space for fields inside the window function (arguments, PARTITION BY and ORDER BY clause) in the ref pointer array. All fields inside the window function are part of the temporary table that is required for the window function computation. --- sql/sql_lex.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'sql/sql_lex.cc') diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc index 2312ec34e7b..c39afdf9e10 100644 --- a/sql/sql_lex.cc +++ b/sql/sql_lex.cc @@ -2140,6 +2140,7 @@ void st_select_lex::init_query() n_sum_items= 0; n_child_sum_items= 0; hidden_bit_fields= 0; + fields_in_window_functions= 0; subquery_in_having= explicit_limit= 0; is_item_list_lookup= 0; changed_elements= 0; @@ -2707,7 +2708,8 @@ bool st_select_lex::setup_ref_array(THD *thd, uint order_group_num) select_n_having_items + select_n_where_fields + order_group_num + - hidden_bit_fields) * 5; + hidden_bit_fields + + fields_in_window_functions) * 5; if (!ref_pointer_array.is_null()) { /* -- cgit v1.2.1