1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

MDEV-25630: Crash with window function in left expr of IN subquery

* Make Item_in_optimizer::fix_fields inherit the with_window_func
  attribute of the subquery's left expression (the subquery itself
  cannot have window functions that are aggregated in this select)

* Make Item_cache_wrapper::Item_cache_wrapper() inherit
  with_window_func attribute of the item it is caching.
This commit is contained in:
Sergei Petrunia
2021-05-22 15:53:33 +03:00
parent dfa2d0bc13
commit c872125a66
5 changed files with 56 additions and 0 deletions

View File

@ -3898,6 +3898,25 @@ id rn
1 1
drop table t1;
#
# MDEV-25630: Crash with window function in left expr of IN subquery
#
CREATE TABLE t1 (i int);
INSERT INTO t1 VALUES (1),(2),(3);
SELECT lag(i) over (ORDER BY i) IN ( SELECT 1 FROM t1 a) FROM t1;
lag(i) over (ORDER BY i) IN ( SELECT 1 FROM t1 a)
NULL
1
0
DROP TABLE t1;
CREATE TABLE t1 (i int);
INSERT INTO t1 VALUES (1),(2),(3);
SELECT sum(i) over () IN ( SELECT 1 FROM t1 a) FROM t1;
sum(i) over () IN ( SELECT 1 FROM t1 a)
0
0
0
DROP TABLE t1;
#
# End of 10.2 tests
#
#