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.test9
1 files changed, 9 insertions, 0 deletions
diff --git a/mysql-test/t/union.test b/mysql-test/t/union.test
index 6d857a4b40f..aeea27ade0f 100644
--- a/mysql-test/t/union.test
+++ b/mysql-test/t/union.test
@@ -209,3 +209,12 @@ explain (select * from t1 where a=1) union (select * from t2 where a=1);
explain (select * from t1 where a=1 and b=10) union (select t1.a,t2.a from t1,t2 where t1.a=t2.a);
explain (select * from t1 where a=1) union (select * from t1 where b=1);
drop table t1,t2;
+create table t1 ( id int not null auto_increment, primary key (id) ,user_name text );
+create table t2 ( id int not null auto_increment, primary key (id) ,group_name text );
+create table t3 ( id int not null auto_increment, primary key (id) ,user_id int ,index user_idx (user_id) ,foreign key (user_id) references users(id) ,group_id int ,index group_idx (group_id) ,foreign key (group_id) references groups(id) );
+insert into t1 (user_name) values ('Tester');
+insert into t2 (group_name) values ('Group A');
+insert into t2 (group_name) values ('Group B');
+insert into t3 (user_id, group_id) values (1,1);
+select 1 'is_in_group', a.user_name, c.group_name, b.id from t1 a, t3 b, t2 c where a.id = b.user_id and b.group_id = c.id UNION select 0 'is_in_group', a.user_name, c.group_name, null from t1 a, t2 c;
+drop table t1, t2, t3;