Commit 57d15d62 authored by Sergei Golubchik's avatar Sergei Golubchik

Add a test case for MySQL's:

  Bug #18167356: EXPLAIN W/ EXISTS(SELECT* UNION SELECT*)
                 WHERE ONE OF SELECT* IS DISTINCT FAILS.

the bugfix itself was not merged - MariaDB doesn't have this bug.
parent 5d16592d
......@@ -1876,8 +1876,8 @@ SELECT(SELECT 1 AS a FROM dual ORDER BY a DESC LIMIT 1) AS dev;
dev
1
#
# LP bug#1010729: Unexpected syntax error from UNION
# (bug #54382) with single-table join nest
# lp:1010729: Unexpected syntax error from UNION
# (bug #54382) with single-table join nest
#
CREATE TABLE t1 (a int);
CREATE TABLE t2 (b int);
......@@ -1892,3 +1892,12 @@ UNION
SELECT t1.pk FROM t1 LEFT JOIN (t2) ON (t1.pk = t2.fk);
pk
DROP TABLE t1,t2;
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);
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL No tables used
2 SUBQUERY t1 ALL NULL NULL NULL NULL 4 Using temporary; Using filesort
3 UNION t1 ALL NULL NULL NULL NULL 4
NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL
drop table t1;
......@@ -1274,8 +1274,8 @@ SELECT(SELECT 1 AS a LIMIT 1) AS dev;
SELECT(SELECT 1 AS a FROM dual ORDER BY a DESC LIMIT 1) AS dev;
--echo #
--echo # LP bug#1010729: Unexpected syntax error from UNION
--echo # (bug #54382) with single-table join nest
--echo # lp:1010729: Unexpected syntax error from UNION
--echo # (bug #54382) with single-table join nest
--echo #
CREATE TABLE t1 (a int);
CREATE TABLE t2 (b int);
......@@ -1292,3 +1292,11 @@ SELECT t1.pk FROM t1 LEFT JOIN (t2) ON (t1.pk = t2.fk);
DROP TABLE t1,t2;
#
# Bug #18167356: EXPLAIN W/ EXISTS(SELECT* UNION SELECT*)
# WHERE ONE OF SELECT* IS DISTINCT FAILS.
#
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;
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment