diff options
author | Igor Babaev <igor@askmonty.org> | 2018-04-19 18:40:31 -0700 |
---|---|---|
committer | Igor Babaev <igor@askmonty.org> | 2018-04-19 18:41:05 -0700 |
commit | 615ad709a3e38e54098f4492f25d102b63979068 (patch) | |
tree | bc6c8c6dd8d2696cdef05af6bf1445dc45e8b645 /mysql-test/main/win_percentile.test | |
parent | cd8b8169b6f39450f10f1ba8a16ae68486bc0975 (diff) | |
download | mariadb-git-615ad709a3e38e54098f4492f25d102b63979068.tar.gz |
MDEV-15902 Assertion `n < m_size' failed, sql_array.h:64:
Element_type& Bounds_checked_array<Element_type>::operator[]
(size_t) [with Element_type = Item*; size_t = long unsigned int]
In sql_yacc.yy the semantic actions for the MEDIAN window function
lacked a call of st_select_lex::prepare_add_window_spec().
This function saves the head of the thd->lex->order_list into
lex->save_order_list in order this head to be restored in
st_select_lex::add_window_spec after the specification of the
window function has been parsed.
Without a call of prepare_add_window_spec() when add_window_spec()
was called the head of an empty list was copied into
thd->lex->order_list (instead of assumed saved head this list).
This made the list thd->lex->order_list invalid and potentially
could cause many different problems.
Corrected the result set in the test case for MDEV-15899 that
used the MEDIAN window function and could not be correct
without this fix.
Diffstat (limited to 'mysql-test/main/win_percentile.test')
-rw-r--r-- | mysql-test/main/win_percentile.test | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/mysql-test/main/win_percentile.test b/mysql-test/main/win_percentile.test index 468d8cff56b..233b21d5f01 100644 --- a/mysql-test/main/win_percentile.test +++ b/mysql-test/main/win_percentile.test @@ -102,3 +102,18 @@ select median(score) over (partition by name), percentile_cont(0.8) within grou select median(score) over (partition by name), percentile_cont(0.9) within group(order by score) over (partition by name) as c from t1; select median(score) over (partition by name), percentile_cont(1) within group(order by score) over (partition by name) as c from t1; drop table t1; + +--echo # +--echo # MDEV-13352: MEDIAN window function over a table with virtual column +--echo # in select with CTE and ORDER BY +--echo # + +CREATE TABLE t1 (f1 int ,f2 int ,f3 int, f4 int, v1 int AS (-f4) virtual); +INSERT INTO t1(f1,f2,f3,f4) VALUES + (1,10,100,10), (7,11,112,15), (3,14,121,12); + +WITH CTE AS (SELECT MIN(f3) OVER () FROM t1) +SELECT MEDIAN(f3) OVER () FROM t1 +ORDER BY f1, f2, f3, f4, v1; + +DROP TABLE t1; |