Skip to content

Commit

Permalink
MDEV-15208: server crashed, when using ORDER BY with window function …
Browse files Browse the repository at this point in the history
…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.
  • Loading branch information
Varun Gupta authored and spetrunia committed Feb 22, 2022
1 parent 942a979 commit 647e952
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions mysql-test/suite/encryption/r/tempfiles_encrypted.result
Original file line number Diff line number Diff line change
Expand Up @@ -4236,6 +4236,14 @@ i LAST_VALUE(COUNT(i)) OVER (PARTITION BY i ORDER BY j)
4 2
DROP TABLE t1;
#
# MDEV-15208: server crashed, when using ORDER BY with window function and UNION
#
CREATE TABLE t1 (a INT);
INSERT INTO t1 VALUES (1),(1),(1),(1),(1),(2),(2),(2),(2),(2),(2);
SELECT 1 UNION SELECT a FROM t1 ORDER BY (row_number() over ());
ERROR HY000: Expression #1 of ORDER BY contains aggregate function and applies to a UNION
DROP TABLE t1;
#
# End of 10.2 tests
#
#
Expand Down

0 comments on commit 647e952

Please sign in to comment.