Skip to content

Commit 647e952

Browse files
Varun Guptaspetrunia
Varun Gupta
authored andcommitted
MDEV-15208: server crashed, when using ORDER BY with window function and UNION
(Edits by SergeiP: fix encryption.tempfiles_encrypted, re-word comment) Global ORDER BY clause of a UNION may not refer to 1) aggregate functions or 2) window functions. setup_order() checked for #1 but not for #2.
1 parent 942a979 commit 647e952

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

mysql-test/suite/encryption/r/tempfiles_encrypted.result

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4236,6 +4236,14 @@ i LAST_VALUE(COUNT(i)) OVER (PARTITION BY i ORDER BY j)
42364236
4 2
42374237
DROP TABLE t1;
42384238
#
4239+
# MDEV-15208: server crashed, when using ORDER BY with window function and UNION
4240+
#
4241+
CREATE TABLE t1 (a INT);
4242+
INSERT INTO t1 VALUES (1),(1),(1),(1),(1),(2),(2),(2),(2),(2),(2);
4243+
SELECT 1 UNION SELECT a FROM t1 ORDER BY (row_number() over ());
4244+
ERROR HY000: Expression #1 of ORDER BY contains aggregate function and applies to a UNION
4245+
DROP TABLE t1;
4246+
#
42394247
# End of 10.2 tests
42404248
#
42414249
#

0 commit comments

Comments
 (0)