summaryrefslogtreecommitdiff
path: root/mysql-test/t/union.test
diff options
context:
space:
mode:
authorunknown <sanja@askmonty.org>2014-11-15 22:18:33 +0100
committerunknown <sanja@askmonty.org>2014-11-15 22:18:33 +0100
commite7c356f7172cf0451eb4a1723623dfab54b8c3c3 (patch)
tree43583bbe16d9c60d666b27c789e1bbe4c30b2e77 /mysql-test/t/union.test
parent665a7c83b90dc01bcca0a78fd0e84bd64e252d7f (diff)
downloadmariadb-git-e7c356f7172cf0451eb4a1723623dfab54b8c3c3.tar.gz
MDEV-6868: MariaDB server crash ( select with union and order by with subquery )
Excluding ORDER BY condition should be done after preparation it (even to catch syntax errors).
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 a5d7dae606f..9204ddd22e5 100644
--- a/mysql-test/t/union.test
+++ b/mysql-test/t/union.test
@@ -1330,3 +1330,23 @@ create table t1 (a int);
insert t1 values (1),(2),(3),(1);
explain select 1 from dual where exists (select max(a) from t1 group by a union select a+2 from t1);
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;