summaryrefslogtreecommitdiff
path: root/mysql-test/t/union.test
diff options
context:
space:
mode:
Diffstat (limited to 'mysql-test/t/union.test')
-rw-r--r--mysql-test/t/union.test20
1 files changed, 20 insertions, 0 deletions
diff --git a/mysql-test/t/union.test b/mysql-test/t/union.test
index 8cb9d53842f..b8b040b0d0d 100644
--- a/mysql-test/t/union.test
+++ b/mysql-test/t/union.test
@@ -1329,6 +1329,26 @@ explain select 1 from dual where exists (select max(a) from t1 group by a union
drop table t1;
--echo #
+--echo # MDEV-6868:MariaDB server crash ( select with union and order by
+--echo # with subquery )
+--echo #
+
+CREATE TABLE t1 ( id INTEGER, sample_name1 VARCHAR(100), sample_name2 VARCHAR(100), PRIMARY KEY(id) );
+
+INSERT INTO t1 ( id, sample_name1, sample_name2 ) VALUES ( 1, 'aaaa', 'bbbb' ), ( 2, 'cccc', 'dddd' );
+
+(
+ SELECT sample_name1 AS testname FROM t1
+)
+UNION
+(
+ SELECT sample_name2 AS testname FROM t1 C ORDER BY (SELECT T.sample_name1 FROM t1 T WHERE T.id = C.id)
+)
+;
+
+drop table t1;
+
+--echo #
--echo # WL#1763 Avoid creating temporary table in UNION ALL
--echo #