summaryrefslogtreecommitdiff
path: root/mysql-test/main/union.result
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.result
parent62a0224666fd0b2790837288cafde009f02e2b52 (diff)
parent8e80fd6bfdf2ea7d1870662ecd4d8129f3c76301 (diff)
downloadmariadb-git-77cbaa96ad9a6077d271bf97b0c0dc8cdf5b5991.tar.gz
Merge 10.2 into 10.3
Diffstat (limited to 'mysql-test/main/union.result')
-rw-r--r--mysql-test/main/union.result38
1 files changed, 38 insertions, 0 deletions
diff --git a/mysql-test/main/union.result b/mysql-test/main/union.result
index a41148f2600..da99d65dec3 100644
--- a/mysql-test/main/union.result
+++ b/mysql-test/main/union.result
@@ -2150,6 +2150,44 @@ select @advertAcctId as a from dual union all select 1.0 from dual;
a
1000003.0
1.0
+#
+# MDEV-13784: query causes seg fault
+#
+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);
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t1 system PRIMARY NULL NULL NULL 1
+2 SUBQUERY t4 eq_ref PRIMARY PRIMARY 4 func 1 Using where
+3 SUBQUERY t2 ref PRIMARY PRIMARY 4 const 3 Using index
+4 UNION t2 ref PRIMARY PRIMARY 4 func 1 Using where; Using index
+5 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
+6 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
+NULL UNION RESULT <union3,4> ALL NULL NULL NULL NULL NULL
+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);
+x
+foo
+drop table t1, t2, t3, t4, t5;
End of 5.5 tests
#
# WL#1763 Avoid creating temporary table in UNION ALL