summaryrefslogtreecommitdiff
path: root/mysql-test/main/union.test
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2019-01-17 13:21:27 +0200
committerMarko Mäkelä <marko.makela@mariadb.com>2019-01-17 13:21:27 +0200
commit9dc81d2a7a6467cea2dc456d75e22d93ad192e1e (patch)
tree541221541cbb7e77b073d229829f97530ea78fb6 /mysql-test/main/union.test
parent890e0278706768e18b28582329418c8943d6a6bd (diff)
parent77cbaa96ad9a6077d271bf97b0c0dc8cdf5b5991 (diff)
downloadmariadb-git-9dc81d2a7a6467cea2dc456d75e22d93ad192e1e.tar.gz
Merge 10.3 into 10.4
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 ca14731600e..dc9a4617fb3 100644
--- a/mysql-test/main/union.test
+++ b/mysql-test/main/union.test
@@ -1495,6 +1495,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 #