diff options
Diffstat (limited to 'mysql-test/main/union.result')
-rw-r--r-- | mysql-test/main/union.result | 40 |
1 files changed, 39 insertions, 1 deletions
diff --git a/mysql-test/main/union.result b/mysql-test/main/union.result index 0c6ddd3675a..7ad588114b6 100644 --- a/mysql-test/main/union.result +++ b/mysql-test/main/union.result @@ -564,7 +564,7 @@ explain (select * from t1 where a=1 and b=10) union (select straight_join t1.a,t id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables 2 UNION t1 index PRIMARY PRIMARY 4 NULL 4 Using index -2 UNION t2 index PRIMARY PRIMARY 4 NULL 4 Using where; Using index; Using join buffer (flat, BNL join) +2 UNION t2 eq_ref PRIMARY PRIMARY 4 test.t1.a 1 Using index NULL UNION RESULT <union1,2> ALL NULL NULL NULL NULL NULL explain (select * from t1 where a=1) union (select * from t1 where b=1); id select_type table type possible_keys key key_len ref rows Extra @@ -2165,6 +2165,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 |