summaryrefslogtreecommitdiff
path: root/mysql-test/t/union.test
diff options
context:
space:
mode:
Diffstat (limited to 'mysql-test/t/union.test')
-rw-r--r--mysql-test/t/union.test24
1 files changed, 22 insertions, 2 deletions
diff --git a/mysql-test/t/union.test b/mysql-test/t/union.test
index 151512515b9..e0c011e3d20 100644
--- a/mysql-test/t/union.test
+++ b/mysql-test/t/union.test
@@ -1057,7 +1057,6 @@ ORDER BY a;
DROP TABLE t1;
---echo End of 5.0 tests
-- echo #
-- echo # Bug#32858: Error: "Incorrect usage of UNION and INTO" does not take
-- echo # subselects into account
@@ -1160,6 +1159,8 @@ create table t1 (a int);
insert into t1 values (10),(10),(10),(2),(3),(4),(5),(6),(7),(8),(9),(1),(10);
--sorted_result
select a from t1 where false UNION select a from t1 limit 8;
+--sorted_result
+(select a from t1 where false) UNION (select a from t1) limit 8;
drop table t1;
--echo #
@@ -1385,6 +1386,26 @@ UNION
drop table t1;
+
+--echo #
+--echo # MDEV-10172: UNION query returns incorrect rows outside
+--echo # conditional evaluation
+--echo #
+
+create table t1 (d datetime not null primary key);
+insert into t1(d) values ('2016-06-01'),('2016-06-02'),('2016-06-03'),('2016-06-04');
+select * from
+(
+ select * from t1 where d between '2016-06-02' and '2016-06-05'
+ union
+ (select * from t1 where d < '2016-06-05' order by d desc limit 1)
+) onlyJun2toJun4
+order by d;
+drop table t1;
+
+--echo End of 5.0 tests
+
+
--echo #
--echo # WL#1763 Avoid creating temporary table in UNION ALL
--echo #
@@ -1486,4 +1507,3 @@ SELECT * FROM t1 t1_1 LEFT JOIN t1 t1_2 ON ( t1_2.b = t1_1.a )
WHERE t1_2.b NOT IN ( SELECT 4 UNION ALL SELECT 5 );
DROP TABLE t1;
-