summaryrefslogtreecommitdiff
path: root/mysql-test/main/union.test
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2019-01-17 12:33:31 +0200
committerMarko Mäkelä <marko.makela@mariadb.com>2019-01-17 12:38:46 +0200
commit77cbaa96ad9a6077d271bf97b0c0dc8cdf5b5991 (patch)
treeba8d2c87f8d15d064657315f48ccb58aa117b95a /mysql-test/main/union.test
parent62a0224666fd0b2790837288cafde009f02e2b52 (diff)
parent8e80fd6bfdf2ea7d1870662ecd4d8129f3c76301 (diff)
downloadmariadb-git-77cbaa96ad9a6077d271bf97b0c0dc8cdf5b5991.tar.gz
Merge 10.2 into 10.3
Diffstat (limited to 'mysql-test/main/union.test')
-rw-r--r--mysql-test/main/union.test35
1 files changed, 35 insertions, 0 deletions
diff --git a/mysql-test/main/union.test b/mysql-test/main/union.test
index 878d7118ef5..e7543ba4a81 100644
--- a/mysql-test/main/union.test
+++ b/mysql-test/main/union.test
@@ -1485,6 +1485,41 @@ eval SET NAMES $old_charset;
SET @advertAcctId = 1000003;
select @advertAcctId as a from dual union all select 1.0 from dual;
+--echo #
+--echo # MDEV-13784: query causes seg fault
+--echo #
+
+CREATE TABLE t1 (`bug_id` int NOT NULL PRIMARY KEY, `product_id` int NOT NULL);
+INSERT INTO t1 VALUES (45199,1184);
+
+CREATE TABLE t2 (`product_id` int NOT NULL,`userid` int NOT NULL, PRIMARY KEY (`product_id`,`userid`));
+INSERT INTO t2 VALUES (1184,103),(1184,624),(1184,1577),(1184,1582);
+
+CREATE TABLE t3 (`id` int NOT NULL PRIMARY KEY,`name` varchar(64));
+
+
+CREATE TABLE t4 ( `userid` int NOT NULL PRIMARY KEY, `login_name` varchar(255));
+INSERT INTO t4 VALUES (103,'foo'),(624,'foo'),(1577,'foo'),(1582,'foo');
+CREATE TABLE t5 (`id` int NOT NULL PRIMARY KEY, `name` varchar(64));
+
+explain select
+(
+ select login_name from t4 where userId = (
+ select userid from t2 where product_id = t1.product_id
+ union
+ select userid from t2 where product_id = (
+ select id from t5 where name = (select name from t3 where id = t1.product_id)) limit 1 )
+) as x from t1 where (t1.bug_id=45199);
+select
+(
+ select login_name from t4 where userId = (
+ select userid from t2 where product_id = t1.product_id
+ union
+ select userid from t2 where product_id = (
+ select id from t5 where name = (select name from t3 where id = t1.product_id)) limit 1 )
+) as x from t1 where (t1.bug_id=45199);
+drop table t1, t2, t3, t4, t5;
+
--echo End of 5.5 tests
--echo #