summaryrefslogtreecommitdiff
path: root/mysql-test
diff options
context:
space:
mode:
authorunknown <monty@narttu.mysql.fi>2003-02-27 03:44:44 +0200
committerunknown <monty@narttu.mysql.fi>2003-02-27 03:44:44 +0200
commit669cbe6e5fffb715e117a96273db9c95e229b3a9 (patch)
treee734507eb0df4722e03a80a37b7b9a4c53728c3e /mysql-test
parenta7e3ba1df50e4be9148baa2396a0d19f4fe73b8e (diff)
downloadmariadb-git-669cbe6e5fffb715e117a96273db9c95e229b3a9.tar.gz
Portability fixes
Don't define crc32 if we are not linking with gzip cmd-line-utils/libedit/libedit_term.h: Rename: cmd-line-utils/libedit/term.h -> cmd-line-utils/libedit/libedit_term.h BitKeeper/etc/ignore: added scripts/make_win_src_distribution client/connect_test.c: Removed wrong include file (my_global.h should never be included by an external client) client/insert_test.c: Removed wrong include file (my_global.h should never be included by an external client) client/select_test.c: Removed wrong include file (my_global.h should never be included by an external client) cmd-line-utils/libedit/Makefile.am: Portability fixes (for HPUX11 and AIX) cmd-line-utils/libedit/el.h: Portability fixes (for HPUX11 and AIX) cmd-line-utils/libedit/key.h: Portability fixes (for HPUX11 and AIX) cmd-line-utils/libedit/makelist: Portability fixes (for HPUX11 and AIX) cmd-line-utils/libedit/read.c: Portability fixes (for HPUX11 and AIX) cmd-line-utils/libedit/readline.c: Portability fixes (for HPUX11 and AIX) cmd-line-utils/libedit/readline/readline.h: Systems that has sys/cdefs may not have __BEGIN_DECLS cmd-line-utils/libedit/sig.c: sig_t is not portable cmd-line-utils/libedit/sig.h: sig_t is not portable cmd-line-utils/libedit/term.c: Portablity fixes Fixed core dump when using a terminal without arrow key definitions heap/_check.c: Portability fix heap/hp_hash.c: Portability fix heap/hp_rkey.c: Portability fix include/my_global.h: Portability fixes for HPUX11 libmysql/libmysql.c: Removed wrong cast mysql-test/r/union.result: New union tests mysql-test/t/union.test: New union tests sql/gen_lex_hash.cc: Fixed portability bug. sql/gstream.h: Portablity fix sql/item_create.cc: Don't define crc32 if we are not linking with gzip sql/item_create.h: Don't define crc32 if we are not linking with gzip sql/item_func.cc: Don't define crc32 if we are not linking with gzip sql/item_func.h: Don't define crc32 if we are not linking with gzip sql/lex.h: Don't define crc32 if we are not linking with gzip sql/sql_show.cc: Name can't be NULL
Diffstat (limited to 'mysql-test')
-rw-r--r--mysql-test/r/union.result33
-rw-r--r--mysql-test/t/union.test17
2 files changed, 50 insertions, 0 deletions
diff --git a/mysql-test/r/union.result b/mysql-test/r/union.result
index cf166f47f35..44d75e54771 100644
--- a/mysql-test/r/union.result
+++ b/mysql-test/r/union.result
@@ -230,3 +230,36 @@ id_master id text1 text2
1 3 NULL bar3
1 4 foo4 bar4
drop table if exists t1,t2;
+create table t1 (a int not null primary key auto_increment, b int, key(b));
+create table t2 (a int not null primary key auto_increment, b int);
+insert into t1 (b) values (1),(2),(2),(3);
+insert into t2 (b) values (10),(11),(12),(13);
+explain (select * from t1 where a=1) union (select * from t2 where a=1);
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t1 const PRIMARY PRIMARY 4 const 1
+2 UNION t2 const PRIMARY PRIMARY 4 const 1
+(select * from t1 where a=5) union (select * from t2 where a=1);
+a b
+1 10
+(select * from t1 where a=5 and a=6) union (select * from t2 where a=1);
+a b
+1 10
+(select t1.a,t1.b from t1,t2 where t1.a=5) union (select * from t2 where a=1);
+a b
+1 10
+(select * from t1 where a=1) union (select t1.a,t2.a from t1,t2 where t1.a=t2.a);
+a b
+1 1
+2 2
+3 3
+4 4
+explain (select * from t1 where a=1 and b=10) union (select t1.a,t2.a from t1,t2 where t1.a=t2.a);
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
+2 UNION t1 index PRIMARY PRIMARY 4 NULL 4 Using index
+2 UNION t2 index PRIMARY PRIMARY 4 NULL 4 Using where; Using index
+explain (select * from t1 where a=1) union (select * from t1 where b=1);
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t1 const PRIMARY PRIMARY 4 const 1
+2 UNION t1 ref b b 5 const 1 Using where
+drop table t1,t2;
diff --git a/mysql-test/t/union.test b/mysql-test/t/union.test
index af2dd154974..b73d9b5fdfc 100644
--- a/mysql-test/t/union.test
+++ b/mysql-test/t/union.test
@@ -124,3 +124,20 @@ INSERT INTO t2 (id, id_master, text1, text2) VALUES("4", "1",
SELECT 1 AS id_master, 1 AS id, NULL AS text1, 'ABCDE' AS text2 UNION SELECT id_master, t2.id, text1, text2 FROM t1 LEFT JOIN t2 ON t1.id = t2.id_master;
SELECT 1 AS id_master, 1 AS id, 'ABCDE' AS text1, 'ABCDE' AS text2 UNION SELECT id_master, t2.id, text1, text2 FROM t1 LEFT JOIN t2 ON t1.id = t2.id_master;
drop table if exists t1,t2;
+
+#
+# Test of bug when using the same table multiple times
+#
+create table t1 (a int not null primary key auto_increment, b int, key(b));
+create table t2 (a int not null primary key auto_increment, b int);
+insert into t1 (b) values (1),(2),(2),(3);
+insert into t2 (b) values (10),(11),(12),(13);
+
+explain (select * from t1 where a=1) union (select * from t2 where a=1);
+(select * from t1 where a=5) union (select * from t2 where a=1);
+(select * from t1 where a=5 and a=6) union (select * from t2 where a=1);
+(select t1.a,t1.b from t1,t2 where t1.a=5) union (select * from t2 where a=1);
+(select * from t1 where a=1) union (select t1.a,t2.a from t1,t2 where t1.a=t2.a);
+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;