1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

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.
This commit is contained in:
Sergei Golubchik
2014-06-03 10:52:36 +02:00
parent 5d16592d44
commit 57d15d62f1
2 changed files with 21 additions and 4 deletions

View File

@ -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;

View File

@ -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;