summaryrefslogtreecommitdiff
path: root/mysql-test/r/union.result
diff options
context:
space:
mode:
Diffstat (limited to 'mysql-test/r/union.result')
-rw-r--r--mysql-test/r/union.result29
1 files changed, 29 insertions, 0 deletions
diff --git a/mysql-test/r/union.result b/mysql-test/r/union.result
index e0aa93d5c97..956703237a1 100644
--- a/mysql-test/r/union.result
+++ b/mysql-test/r/union.result
@@ -2178,6 +2178,35 @@ WHERE t1_2.b NOT IN ( SELECT 4 UNION ALL SELECT 5 );
a b a b
1 1 1 1
DROP TABLE t1;
+# Bug mdev-12788: UNION ALL + impossible having for derived
+# with IN subquery in WHERE
+#
+CREATE TABLE t1 (i int) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (1);
+CREATE TABLE t2 (pk int PRIMARY KEY) ENGINE=MyISAM;
+INSERT INTO t2 VALUES (1),(2);
+SELECT 1, 2
+UNION ALL
+SELECT i, COUNT(*) FROM (
+SELECT * FROM t1 WHERE i IN ( SELECT pk FROM t2 )
+) AS sq
+GROUP BY i
+HAVING i = 10;
+1 2
+1 2
+EXPLAIN EXTENDED SELECT 1, 2
+UNION ALL
+SELECT i, COUNT(*) FROM (
+SELECT * FROM t1 WHERE i IN ( SELECT pk FROM t2 )
+) AS sq
+GROUP BY i
+HAVING i = 10;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+2 UNION NULL NULL NULL NULL NULL NULL NULL NULL Impossible HAVING noticed after reading const tables
+Warnings:
+Note 1003 /* select#1 */ select 1 AS `1`,2 AS `2` union all /* select#2 */ select 1 AS `i`,count(0) AS `COUNT(*)` from `test`.`t2` where 1 group by 1 having 0
+DROP TABLE t1,t2;
#
# Start of 10.3 tests
#