summaryrefslogtreecommitdiff
path: root/mysql-test
diff options
context:
space:
mode:
authorunknown <monty@mashka.mysql.fi>2002-11-21 15:56:48 +0200
committerunknown <monty@mashka.mysql.fi>2002-11-21 15:56:48 +0200
commit33fc0d53b543032accea2476a4eed0522cead2bb (patch)
treed3df5d3fc1abf364dcbcc8eb2305a1cf62540192 /mysql-test
parent2723dbdb5e2c60162ca464f65f68fdd13b7c9cef (diff)
parent70a17cd5a7aab52697b494cd8379fb78db15eeea (diff)
downloadmariadb-git-33fc0d53b543032accea2476a4eed0522cead2bb.tar.gz
Merge with 4.0
BitKeeper/etc/gone: auto-union BitKeeper/etc/ignore: auto-union BitKeeper/etc/logging_ok: auto-union BitKeeper/deleted/.del-.my_sys.h.swp~f6a4a7f8dae03f18: Auto merged BitKeeper/etc/config: Auto merged acconfig.h: Auto merged acinclude.m4: Auto merged Docs/manual.texi: Auto merged client/mysqlcheck.c: Auto merged client/mysqlshow.c: Auto merged include/myisam.h: Auto merged include/violite.h: Auto merged isam/pack_isam.c: Auto merged libmysql/libmysql.c: Auto merged libmysqld/lib_sql.cc: Auto merged myisam/Makefile.am: Auto merged myisam/ft_nlq_search.c: Auto merged myisam/mi_open.c: Auto merged myisam/mi_write.c: Auto merged myisam/sort.c: Auto merged mysql-test/mysql-test-run.sh: Auto merged mysql-test/r/fulltext.result: Auto merged mysql-test/r/func_test.result: Auto merged mysql-test/r/isam.result: Auto merged mysql-test/r/rpl_replicate_do.result: Auto merged mysql-test/r/variables.result: Auto merged mysql-test/t/func_test.test: Auto merged mysql-test/t/myisam.test: Auto merged mysql-test/t/rpl_rotate_logs.test: Auto merged mysql-test/t/variables.test: Auto merged mysys/hash.c: Auto merged mysys/tree.c: Auto merged scripts/Makefile.am: Auto merged sql/Makefile.am: Auto merged sql/filesort.cc: Auto merged sql/gen_lex_hash.cc: Auto merged sql/ha_berkeley.cc: Auto merged sql/ha_innodb.cc: Auto merged sql/handler.cc: Auto merged sql/handler.h: Auto merged sql/hash_filo.h: Auto merged sql/hostname.cc: Auto merged sql/item_func.cc: Auto merged sql/item_func.h: Auto merged sql/item_timefunc.cc: Auto merged sql/lex.h: Auto merged sql/lock.cc: Auto merged sql/log.cc: Auto merged sql/log_event.h: Auto merged sql/mini_client.cc: Auto merged sql/opt_range.cc: Auto merged sql/opt_sum.cc: Auto merged sql/repl_failsafe.cc: Auto merged sql/set_var.h: Auto merged sql/slave.h: Auto merged sql/sql_acl.cc: Auto merged sql/sql_analyse.cc: Auto merged sql/sql_cache.cc: Auto merged sql/sql_insert.cc: Auto merged sql/sql_load.cc: Auto merged sql/sql_rename.cc: Auto merged sql/sql_repl.cc: Auto merged sql/sql_show.cc: Auto merged sql/sql_table.cc: Auto merged sql/sql_udf.cc: Auto merged sql/share/czech/errmsg.txt: Auto merged sql/share/danish/errmsg.txt: Auto merged sql/share/dutch/errmsg.txt: Auto merged sql/share/english/errmsg.txt: Auto merged sql/share/estonian/errmsg.txt: Auto merged sql/share/french/errmsg.txt: Auto merged sql/share/german/errmsg.txt: Auto merged sql/share/greek/errmsg.txt: Auto merged sql/share/hungarian/errmsg.txt: Auto merged sql/share/italian/errmsg.txt: Auto merged sql/share/japanese/errmsg.txt: Auto merged sql/share/korean/errmsg.txt: Auto merged sql/share/norwegian/errmsg.txt: Auto merged sql/table.h: Auto merged sql/unireg.cc: Auto merged sql-bench/server-cfg.sh: Auto merged sql/share/norwegian-ny/errmsg.txt: Auto merged sql/share/polish/errmsg.txt: Auto merged sql/share/portuguese/errmsg.txt: Auto merged sql/share/romanian/errmsg.txt: Auto merged sql/share/russian/errmsg.txt: Auto merged sql/share/slovak/errmsg.txt: Auto merged sql/share/spanish/errmsg.txt: Auto merged sql/share/swedish/errmsg.txt: Auto merged sql/share/ukrainian/errmsg.txt: Auto merged sql/ha_myisam.cc: Merge with 4.0 Removed some commented code sql/sql_db.cc: Merge with 4.0 Optimized the logging of the drop db call a bit sql/sql_update.cc: Added comment
Diffstat (limited to 'mysql-test')
-rw-r--r--mysql-test/mysql-test-run.sh27
-rw-r--r--mysql-test/r/bdb.result14
-rw-r--r--mysql-test/r/bdb_cache.result100
-rw-r--r--mysql-test/r/bool.result74
-rw-r--r--mysql-test/r/compare.result2
-rw-r--r--mysql-test/r/create.result2
-rw-r--r--mysql-test/r/distinct.result12
-rw-r--r--mysql-test/r/explain.result4
-rw-r--r--mysql-test/r/fulltext.result3
-rw-r--r--mysql-test/r/func_time.result24
-rw-r--r--mysql-test/r/group_by.result41
-rw-r--r--mysql-test/r/heap.result12
-rw-r--r--mysql-test/r/innodb.result20
-rw-r--r--mysql-test/r/isam.result6
-rw-r--r--mysql-test/r/join_outer.result14
-rw-r--r--mysql-test/r/key_diff.result2
-rw-r--r--mysql-test/r/merge.result59
-rw-r--r--mysql-test/r/multi_update.result27
-rw-r--r--mysql-test/r/myisam.result220
-rw-r--r--mysql-test/r/null.result2
-rw-r--r--mysql-test/r/null_key.result48
-rw-r--r--mysql-test/r/order_by.result38
-rw-r--r--mysql-test/r/query_cache.result6
-rw-r--r--mysql-test/r/rpl000007.result20
-rw-r--r--mysql-test/r/rpl_replicate_do.result28
-rw-r--r--mysql-test/r/rpl_rotate_logs.result3
-rw-r--r--mysql-test/r/select.result26
-rw-r--r--mysql-test/r/temp_table.result22
-rw-r--r--mysql-test/r/type_datetime.result2
-rw-r--r--mysql-test/r/type_decimal.result11
-rw-r--r--mysql-test/r/user_var.result8
-rw-r--r--mysql-test/r/variables.result6
-rw-r--r--mysql-test/t/bdb.test2
-rw-r--r--mysql-test/t/bdb_cache-master.opt1
-rw-r--r--mysql-test/t/bdb_cache.test50
-rw-r--r--mysql-test/t/bool.test51
-rw-r--r--mysql-test/t/fulltext.test1
-rw-r--r--mysql-test/t/func_time.test22
-rw-r--r--mysql-test/t/group_by.test41
-rw-r--r--mysql-test/t/merge.test52
-rw-r--r--mysql-test/t/multi_update.test28
-rw-r--r--mysql-test/t/myisam.test232
-rw-r--r--mysql-test/t/query_cache.test2
-rw-r--r--mysql-test/t/rpl000007-slave.opt1
-rw-r--r--mysql-test/t/rpl000007.test24
-rw-r--r--mysql-test/t/rpl_replicate_do-slave.opt1
-rw-r--r--mysql-test/t/rpl_replicate_do.test30
-rw-r--r--mysql-test/t/rpl_rotate_logs.test4
-rw-r--r--mysql-test/t/temp_table.test18
-rw-r--r--mysql-test/t/type_decimal.test10
-rw-r--r--mysql-test/t/variables.test6
51 files changed, 1266 insertions, 193 deletions
diff --git a/mysql-test/mysql-test-run.sh b/mysql-test/mysql-test-run.sh
index cf9b6653c5a..d585243c6bc 100644
--- a/mysql-test/mysql-test-run.sh
+++ b/mysql-test/mysql-test-run.sh
@@ -56,6 +56,7 @@ sleep_until_file_deleted ()
sleep $SLEEP_TIME_AFTER_RESTART
return
fi
+ sleep 1
loop=`expr $loop - 1`
done
}
@@ -314,6 +315,17 @@ while test $# -gt 0; do
DO_DDD=1
USE_RUNNING_SERVER=""
;;
+ --valgrind)
+ VALGRIND="valgrind --alignment=8 --leak-check=yes"
+ EXTRA_MASTER_MYSQLD_OPT="$EXTRA_MASTER_MYSQLD_OPT --skip-safemalloc"
+ EXTRA_SLAVE_MYSQLD_OPT="$EXTRA_SLAVE_MYSQLD_OPT --skip-safemalloc"
+ SLEEP_TIME_AFTER_RESTART=120
+ SLEEP_TIME_FOR_DELETE=120
+ ;;
+ --valgrind-options=*)
+ TMP=`$ECHO "$1" | $SED -e "s;--valgrind-options=;;"`
+ VALGRIND="$VALGRIND $TMP"
+ ;;
--skip-*)
EXTRA_MASTER_MYSQLD_OPT="$EXTRA_MASTER_MYSQLD_OPT $1"
EXTRA_SLAVE_MYSQLD_OPT="$EXTRA_SLAVE_MYSQLD_OPT $1"
@@ -374,6 +386,7 @@ fi
[ -d $MYSQL_TEST_DIR/var ] || mkdir $MYSQL_TEST_DIR/var
[ -d $MYSQL_TEST_DIR/var/tmp ] || mkdir $MYSQL_TEST_DIR/var/tmp
[ -d $MYSQL_TEST_DIR/var/run ] || mkdir $MYSQL_TEST_DIR/var/run
+[ -d $MYSQL_TEST_DIR/var/log ] || mkdir $MYSQL_TEST_DIR/var/log
if test ${COLUMNS:-0} -lt 80 ; then COLUMNS=80 ; fi
E=`$EXPR $COLUMNS - 8`
@@ -382,7 +395,7 @@ DASH72=`$ECHO '-----------------------------------------------------------------
# on source dist, we pick up freshly build executables
# on binary, use what is installed
if [ x$SOURCE_DIST = x1 ] ; then
- MYSQLD="$BASEDIR/sql/mysqld"
+ MYSQLD="$VALGRIND $BASEDIR/sql/mysqld"
if [ -f "$BASEDIR/client/.libs/lt-mysqltest" ] ; then
MYSQL_TEST="$BASEDIR/client/.libs/lt-mysqltest"
elif [ -f "$BASEDIR/client/.libs/mysqltest" ] ; then
@@ -405,9 +418,9 @@ if [ x$SOURCE_DIST = x1 ] ; then
else
if test -x "$BASEDIR/libexec/mysqld"
then
- MYSQLD="$BASEDIR/libexec/mysqld"
+ MYSQLD="$VALGRIND $BASEDIR/libexec/mysqld"
else
- MYSQLD="$BASEDIR/bin/mysqld"
+ MYSQLD="$VALGRIND $BASEDIR/bin/mysqld"
fi
MYSQL_TEST="$BASEDIR/bin/mysqltest"
MYSQLADMIN="$BASEDIR/bin/mysqladmin"
@@ -459,8 +472,8 @@ fi
MYSQL_TEST_ARGS="--no-defaults --socket=$MASTER_MYSOCK --database=$DB \
- --user=$DBUSER --password=$DBPASSWD --silent -v \
- --tmpdir=$MYSQL_TMP_DIR"
+ --user=$DBUSER --password=$DBPASSWD --silent -v --skip-safemalloc \
+ --tmpdir=$MYSQL_TMP_DIR --port=$MASTER_MYPORT"
MYSQL_TEST_BIN=$MYSQL_TEST
MYSQL_TEST="$MYSQL_TEST $MYSQL_TEST_ARGS"
GDB_CLIENT_INIT=$MYSQL_TMP_DIR/gdbinit.client
@@ -706,7 +719,7 @@ manager_launch()
ident=$1
shift
if [ $USE_MANAGER = 0 ] ; then
- $@ >$CUR_MYERR 2>&1 &
+ $@ >> $CUR_MYERR 2>&1 &
sleep 2 #hack
return
fi
@@ -1052,6 +1065,8 @@ run_testcase ()
slave_init_script=$TESTDIR/$tname-slave.sh
slave_master_info_file=$TESTDIR/$tname-slave-master-info.opt
echo $tname > $CURRENT_TEST
+ echo "CURRENT_TEST: $tname" >> $SLAVE_MYERR
+ echo "CURRENT_TEST: $tname" >> $MASTER_MYERR
SKIP_SLAVE=`$EXPR \( $tname : rpl \) = 0`
if [ $USE_MANAGER = 1 ] ; then
many_slaves=`$EXPR \( $tname : rpl_failsafe \) != 0`
diff --git a/mysql-test/r/bdb.result b/mysql-test/r/bdb.result
index 0abf48041d6..ef4dfc307bf 100644
--- a/mysql-test/r/bdb.result
+++ b/mysql-test/r/bdb.result
@@ -133,20 +133,20 @@ id parent_id level
1202 107 2
1204 107 2
update ignore t1 set id=1023 where id=1010;
-select * from t1 where parent_id=102;
+select * from t1 where parent_id=102 order by parent_id,id;
id parent_id level
1008 102 2
-1015 102 2
1010 102 2
+1015 102 2
explain select level from t1 where level=1;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ref level level 1 const 1 where used; Using index
+1 SIMPLE t1 ref level level 1 const 1 Using where; Using index
explain select level,id from t1 where level=1;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ref level level 1 const 1 where used; Using index
+1 SIMPLE t1 ref level level 1 const 1 Using where; Using index
explain select level,id,parent_id from t1 where level=1;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ref level level 1 const 1 where used
+1 SIMPLE t1 ref level level 1 const 1 Using where
select level,id from t1 where level=1;
level id
1 1002
@@ -203,7 +203,7 @@ a
2
check table t1;
Table Op Msg_type Msg_text
-test.t1 check error The handler for the table doesn't support check/repair
+test.t1 check error The handler for the table doesn't support check
drop table t1;
create table t1 (a int,b varchar(20)) type=bdb;
insert into t1 values (1,""), (2,"testing");
@@ -625,7 +625,7 @@ id parent_id level
1016 102 2
explain select level from t1 where level=1;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ref level level 1 const 1 where used; Using index
+1 SIMPLE t1 ref level level 1 const 1 Using where; Using index
select level,id from t1 where level=1;
level id
1 1004
diff --git a/mysql-test/r/bdb_cache.result b/mysql-test/r/bdb_cache.result
new file mode 100644
index 00000000000..e5c6923162a
--- /dev/null
+++ b/mysql-test/r/bdb_cache.result
@@ -0,0 +1,100 @@
+drop table if exists t1, t2, t3;
+flush status;
+set autocommit=0;
+create table t1 (a int not null) type=bdb;
+insert into t1 values (1),(2),(3);
+select * from t1;
+a
+1
+2
+3
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 0
+drop table t1;
+commit;
+set autocommit=1;
+begin;
+create table t1 (a int not null) type=bdb;
+insert into t1 values (1),(2),(3);
+select * from t1;
+a
+1
+2
+3
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 0
+drop table t1;
+commit;
+create table t1 (a int not null) type=bdb;
+create table t2 (a int not null) type=bdb;
+create table t3 (a int not null) type=bdb;
+insert into t1 values (1),(2);
+insert into t2 values (1),(2);
+insert into t3 values (1),(2);
+select * from t1;
+a
+1
+2
+select * from t2;
+a
+1
+2
+select * from t3;
+a
+1
+2
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 3
+show status like "Qcache_hits";
+Variable_name Value
+Qcache_hits 0
+begin;
+select * from t1;
+a
+1
+2
+select * from t2;
+a
+1
+2
+select * from t3;
+a
+1
+2
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 3
+show status like "Qcache_hits";
+Variable_name Value
+Qcache_hits 0
+insert into t1 values (3);
+insert into t2 values (3);
+insert into t1 values (4);
+select * from t1;
+a
+1
+2
+3
+4
+select * from t2;
+a
+1
+2
+3
+select * from t3;
+a
+1
+2
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 3
+show status like "Qcache_hits";
+Variable_name Value
+Qcache_hits 0
+commit;
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 1
diff --git a/mysql-test/r/bool.result b/mysql-test/r/bool.result
new file mode 100644
index 00000000000..cb82c6baa0f
--- /dev/null
+++ b/mysql-test/r/bool.result
@@ -0,0 +1,74 @@
+DROP TABLE IF EXISTS t1;
+SELECT IF(NULL AND 1, 1, 2), IF(1 AND NULL, 1, 2);
+IF(NULL AND 1, 1, 2) IF(1 AND NULL, 1, 2)
+2 2
+SELECT NULL AND 1, 1 AND NULL, 0 AND NULL, NULL and 0;
+NULL AND 1 1 AND NULL 0 AND NULL NULL and 0
+NULL NULL 0 0
+create table t1 (a int);
+insert into t1 values (0),(1),(NULL);
+SELECT * FROM t1 WHERE IF(a AND 1, 0, 1);
+a
+0
+NULL
+SELECT * FROM t1 WHERE IF(1 AND a, 0, 1);
+a
+0
+NULL
+SELECT * FROM t1 where NOT(a AND 1);
+a
+0
+SELECT * FROM t1 where NOT(1 AND a);
+a
+0
+SELECT * FROM t1 where (a AND 1)=0;
+a
+0
+SELECT * FROM t1 where (1 AND a)=0;
+a
+0
+SELECT * FROM t1 where (1 AND a)=1;
+a
+1
+SELECT * FROM t1 where (1 AND a) IS NULL;
+a
+NULL
+SET @a=0, @b=0;
+SELECT * FROM t1 WHERE NULL AND (@a:=@a+1);
+a
+SELECT * FROM t1 WHERE NOT(a>=0 AND NULL AND (@b:=@b+1));
+a
+SELECT * FROM t1 WHERE a=2 OR (NULL AND (@a:=@a+1));
+a
+SELECT * FROM t1 WHERE NOT(a=2 OR (NULL AND (@b:=@b+1)));
+a
+SELECT @a, @b;
+@a @b
+0 6
+DROP TABLE t1;
+drop table if exists t;
+create table t(a int, b int);
+insert into t values(null, null), (0, null), (1, null), (null, 0), (null, 1), (0, 0), (0, 1), (1, 0), (1, 1);
+select ifnull(A, 'N') as A, ifnull(B, 'N') as B, ifnull(not A, 'N') as nA, ifnull(not B, 'N') as nB, ifnull(A and B, 'N') as AB, ifnull(not (A and B), 'N') as `n(AB)`, ifnull((not A or not B), 'N') as nAonB, ifnull(A or B, 'N') as AoB, ifnull(not(A or B), 'N') as `n(AoB)`, ifnull(not A and not B, 'N') as nAnB from t;
+A B nA nB AB n(AB) nAonB AoB n(AoB) nAnB
+N N N N N N N N N N
+0 N 1 N 0 1 1 N N N
+1 N 0 N N N N 1 0 0
+N 0 N 1 0 1 1 N N N
+N 1 N 0 N N N 1 0 0
+0 0 1 1 0 1 1 0 1 1
+0 1 1 0 0 1 1 1 0 0
+1 0 0 1 0 1 1 1 0 0
+1 1 0 0 1 0 0 1 0 0
+select ifnull(A=1, 'N') as A, ifnull(B=1, 'N') as B, ifnull(not (A=1), 'N') as nA, ifnull(not (B=1), 'N') as nB, ifnull((A=1) and (B=1), 'N') as AB, ifnull(not ((A=1) and (B=1)), 'N') as `n(AB)`, ifnull((not (A=1) or not (B=1)), 'N') as nAonB, ifnull((A=1) or (B=1), 'N') as AoB, ifnull(not((A=1) or (B=1)), 'N') as `n(AoB)`, ifnull(not (A=1) and not (B=1), 'N') as nAnB from t;
+A B nA nB AB n(AB) nAonB AoB n(AoB) nAnB
+N N N N N N N N N N
+0 N 1 N 0 1 1 N N N
+1 N 0 N N N N 1 0 0
+N 0 N 1 0 1 1 N N N
+N 1 N 0 N N N 1 0 0
+0 0 1 1 0 1 1 0 1 1
+0 1 1 0 0 1 1 1 0 0
+1 0 0 1 0 1 1 1 0 0
+1 1 0 0 1 0 0 1 0 0
+drop table t;
diff --git a/mysql-test/r/compare.result b/mysql-test/r/compare.result
index 10f149e7a9b..3ad3465fac0 100644
--- a/mysql-test/r/compare.result
+++ b/mysql-test/r/compare.result
@@ -3,7 +3,7 @@ CREATE TABLE t1 (id CHAR(12) not null, PRIMARY KEY (id));
insert into t1 values ('000000000001'),('000000000002');
explain select * from t1 where id=000000000001;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 index PRIMARY PRIMARY 12 NULL 2 where used; Using index
+1 SIMPLE t1 index PRIMARY PRIMARY 12 NULL 2 Using where; Using index
select * from t1 where id=000000000001;
id
000000000001
diff --git a/mysql-test/r/create.result b/mysql-test/r/create.result
index 49a42872fa3..0be0d624fca 100644
--- a/mysql-test/r/create.result
+++ b/mysql-test/r/create.result
@@ -62,7 +62,7 @@ insert into t1 (b) values ("hello"),("my"),("world");
create table t2 (key (b)) select * from t1;
explain select * from t2 where b="world";
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t2 ref B B 21 const 1 where used
+1 SIMPLE t2 ref B B 21 const 1 Using where
select * from t2 where b="world";
a B
3 world
diff --git a/mysql-test/r/distinct.result b/mysql-test/r/distinct.result
index 057e0308313..fec5ece8ddf 100644
--- a/mysql-test/r/distinct.result
+++ b/mysql-test/r/distinct.result
@@ -175,7 +175,7 @@ explain SELECT distinct t3.a FROM t3,t2,t1 WHERE t3.a=t1.b AND t1.a=t2.a;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t3 index a a 5 NULL 6 Using index; Using temporary
1 SIMPLE t2 index a a 4 NULL 5 Using index; Distinct
-1 SIMPLE t1 eq_ref PRIMARY PRIMARY 4 t2.a 1 where used; Distinct
+1 SIMPLE t1 eq_ref PRIMARY PRIMARY 4 t2.a 1 Using where; Distinct
SELECT distinct t3.a FROM t3,t2,t1 WHERE t3.a=t1.b AND t1.a=t2.a;
a
1
@@ -190,7 +190,7 @@ insert into t3 select * from t4;
explain select distinct t1.a from t1,t3 where t1.a=t3.a;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index PRIMARY PRIMARY 4 NULL 2 Using index; Using temporary
-1 SIMPLE t3 ref a a 5 t1.a 10 where used; Using index; Distinct
+1 SIMPLE t3 ref a a 5 t1.a 10 Using where; Using index; Distinct
select distinct t1.a from t1,t3 where t1.a=t3.a;
a
1
@@ -278,10 +278,10 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index id id 4 NULL 2 Using index; Using temporary
1 SIMPLE t2 index id id 8 NULL 1 Using index; Distinct
1 SIMPLE t3 index id id 8 NULL 1 Using index; Distinct
-1 SIMPLE j_lj_t2 index id id 4 NULL 2 where used; Using index; Distinct
-1 SIMPLE t2_lj index id id 8 NULL 1 where used; Using index; Distinct
-1 SIMPLE j_lj_t3 index id id 4 NULL 2 where used; Using index; Distinct
-1 SIMPLE t3_lj index id id 8 NULL 1 where used; Using index; Distinct
+1 SIMPLE j_lj_t2 index id id 4 NULL 2 Using where; Using index; Distinct
+1 SIMPLE t2_lj index id id 8 NULL 1 Using where; Using index; Distinct
+1 SIMPLE j_lj_t3 index id id 4 NULL 2 Using where; Using index; Distinct
+1 SIMPLE t3_lj index id id 8 NULL 1 Using where; Using index; Distinct
SELECT DISTINCT
t1.id
from
diff --git a/mysql-test/r/explain.result b/mysql-test/r/explain.result
index 0d97aeaf531..dafed9a7d41 100644
--- a/mysql-test/r/explain.result
+++ b/mysql-test/r/explain.result
@@ -10,13 +10,13 @@ id str
3 foo
explain select * from t1 where str is null;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ref str str 11 const 1 where used
+1 SIMPLE t1 ref str str 11 const 1 Using where
explain select * from t1 where str="foo";
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 const str str 11 const 1
explain select * from t1 ignore key (str) where str="foo";
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ALL NULL NULL NULL NULL 4 where used
+1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using where
explain select * from t1 use key (str,str) where str="foo";
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 const str str 11 const 1
diff --git a/mysql-test/r/fulltext.result b/mysql-test/r/fulltext.result
index ea632732017..a991981bf21 100644
--- a/mysql-test/r/fulltext.result
+++ b/mysql-test/r/fulltext.result
@@ -85,6 +85,9 @@ Full-text search in MySQL implements vector space model
select * from t1 where MATCH a,b AGAINST ('"text search" +"now support"' IN BOOLEAN MODE);
a b
MySQL has now support for full-text search
+select * from t1 where MATCH a,b AGAINST ('"text i"' IN BOOLEAN MODE);
+a b
+Full-text indexes are called collections
select * from t1 where MATCH a AGAINST ("search" IN BOOLEAN MODE);
a b
Full-text search in MySQL implements vector space model
diff --git a/mysql-test/r/func_time.result b/mysql-test/r/func_time.result
index 5433194c719..4a1012f73bf 100644
--- a/mysql-test/r/func_time.result
+++ b/mysql-test/r/func_time.result
@@ -1,4 +1,4 @@
-drop table if exists t1,t2;
+drop table if exists t1,t2,t3;
select from_days(to_days("960101")),to_days(960201)-to_days("19960101"),to_days(date_add(curdate(), interval 1 day))-to_days(curdate()),weekday("1997-11-29");
from_days(to_days("960101")) to_days(960201)-to_days("19960101") to_days(date_add(curdate(), interval 1 day))-to_days(curdate()) weekday("1997-11-29")
1996-01-01 31 1 5
@@ -84,6 +84,12 @@ select yearweek("2000-01-01",1) as '2000', yearweek("2001-01-01",1) as '2001', y
select yearweek("2000-01-06",1) as '2000', yearweek("2001-01-06",1) as '2001', yearweek("2002-01-06",1) as '2002',yearweek("2003-01-06",1) as '2003', yearweek("2004-01-06",1) as '2004', yearweek("2005-01-06",1) as '2005', yearweek("2006-01-06",1) as '2006';
2000 2001 2002 2003 2004 2005 2006
200001 200101 200201 200302 200402 200501 200601
+select week(19981231,2), week(19981231,3), week(20000101,2), week(20000101,3);
+week(19981231,2) week(19981231,3) week(20000101,2) week(20000101,3)
+52 53 52 52
+select week(20001231,2),week(20001231,3);
+week(20001231,2) week(20001231,3)
+1 52
select date_format('1998-12-31','%x-%v'),date_format('1999-01-01','%x-%v');
date_format('1998-12-31','%x-%v') date_format('1999-01-01','%x-%v')
1998-53 1998-53
@@ -372,3 +378,19 @@ select extract(MONTH FROM "0000-00-00"),extract(MONTH FROM d),extract(MONTH FROM
extract(MONTH FROM "0000-00-00") extract(MONTH FROM d) extract(MONTH FROM dt) extract(MONTH FROM t) extract(MONTH FROM c)
0 0 0 0 0
drop table t1;
+CREATE TABLE t1 ( start datetime default NULL);
+INSERT INTO t1 VALUES ('2002-10-21 00:00:00'),('2002-10-28 00:00:00'),('2002-11-04 00:00:00');
+CREATE TABLE t2 ( ctime1 timestamp(14) NOT NULL, ctime2 timestamp(14) NOT NULL);
+INSERT INTO t2 VALUES (20021029165106,20021105164731);
+CREATE TABLE t3 (ctime1 char(19) NOT NULL, ctime2 char(19) NOT NULL);
+INSERT INTO t3 VALUES ("2002-10-29 16:51:06","2002-11-05 16:47:31");
+select * from t1, t2 where t1.start between t2.ctime1 and t2.ctime2;
+start ctime1 ctime2
+2002-11-04 00:00:00 20021029165106 20021105164731
+select * from t1, t2 where t1.start >= t2.ctime1 and t1.start <= t2.ctime2;
+start ctime1 ctime2
+2002-11-04 00:00:00 20021029165106 20021105164731
+select * from t1, t3 where t1.start between t3.ctime1 and t3.ctime2;
+start ctime1 ctime2
+2002-11-04 00:00:00 2002-10-29 16:51:06 2002-11-05 16:47:31
+drop table t1,t2,t3;
diff --git a/mysql-test/r/group_by.result b/mysql-test/r/group_by.result
index 449d7bcb818..86a8eb2dd22 100644
--- a/mysql-test/r/group_by.result
+++ b/mysql-test/r/group_by.result
@@ -1,4 +1,4 @@
-drop table if exists t1,t2;
+drop table if exists t1,t2,t3;
CREATE TABLE t1 (
spID int(10) unsigned,
userID int(10) unsigned,
@@ -234,10 +234,10 @@ userid count(*)
1 2
explain select spid,count(*) from t1 where spid between 1 and 2 group by spid desc;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range spID spID 5 NULL 2 where used; Using index
+1 SIMPLE t1 range spID spID 5 NULL 2 Using where; Using index
explain select spid,count(*) from t1 where spid between 1 and 2 group by spid;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range spID spID 5 NULL 2 where used; Using index
+1 SIMPLE t1 range spID spID 5 NULL 2 Using where; Using index
select spid,count(*) from t1 where spid between 1 and 2 group by spid;
spid count(*)
1 1
@@ -417,3 +417,38 @@ xID xID1 Level
3 134 ***
4 185 ****
drop table t1;
+CREATE TABLE t1 (
+pid int(11) unsigned NOT NULL default '0',
+c1id int(11) unsigned default NULL,
+c2id int(11) unsigned default NULL,
+value int(11) unsigned NOT NULL default '0',
+UNIQUE KEY pid2 (pid,c1id,c2id),
+UNIQUE KEY pid (pid,value)
+) TYPE=MyISAM;
+INSERT INTO t1 VALUES (1, 1, NULL, 1),(1, 2, NULL, 2),(1, NULL, 3, 3),(1, 4, NULL, 4),(1, 5, NULL, 5);
+CREATE TABLE t2 (
+id int(11) unsigned NOT NULL default '0',
+active enum('Yes','No') NOT NULL default 'Yes',
+PRIMARY KEY (id)
+) TYPE=MyISAM;
+INSERT INTO t2 VALUES (1, 'Yes'),(2, 'No'),(4, 'Yes'),(5, 'No');
+CREATE TABLE t3 (
+id int(11) unsigned NOT NULL default '0',
+active enum('Yes','No') NOT NULL default 'Yes',
+PRIMARY KEY (id)
+);
+INSERT INTO t3 VALUES (3, 'Yes');
+select * from t1 AS m LEFT JOIN t2 AS c1 ON m.c1id =
+c1.id AND c1.active = 'Yes' LEFT JOIN t3 AS c2 ON m.c2id = c2.id AND
+c2.active = 'Yes' WHERE m.pid=1 AND (c1.id IS NOT NULL OR c2.id IS NOT NULL);
+pid c1id c2id value id active id active
+1 1 NULL 1 1 Yes NULL NULL
+1 NULL 3 3 NULL NULL 3 Yes
+1 4 NULL 4 4 Yes NULL NULL
+select max(value) from t1 AS m LEFT JOIN t2 AS c1 ON
+m.c1id = c1.id AND c1.active = 'Yes' LEFT JOIN t3 AS c2 ON m.c2id =
+c2.id AND c2.active = 'Yes' WHERE m.pid=1 AND (c1.id IS NOT NULL OR c2.id IS
+NOT NULL);
+max(value)
+4
+drop table t1,t2,t3;
diff --git a/mysql-test/r/heap.result b/mysql-test/r/heap.result
index 8fe87cdda8b..ffd62ceabb6 100644
--- a/mysql-test/r/heap.result
+++ b/mysql-test/r/heap.result
@@ -66,7 +66,7 @@ a
alter table t1 type=myisam;
explain select * from t1 where a in (869751,736494,226312,802616);
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range uniq_id uniq_id 4 NULL 4 where used; Using index
+1 SIMPLE t1 range uniq_id uniq_id 4 NULL 4 Using where; Using index
drop table t1;
create table t1 (x int not null, y int not null, key x (x), unique y (y))
type=heap;
@@ -159,17 +159,17 @@ create table t1 (btn char(10) not null, key(btn)) type=heap;
insert into t1 values ("hello"),("hello"),("hello"),("hello"),("hello"),("a"),("b"),("c"),("d"),("e"),("f"),("g"),("h"),("i");
explain select * from t1 where btn like "q%";
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ALL btn NULL NULL NULL 14 where used
+1 SIMPLE t1 ALL btn NULL NULL NULL 14 Using where
select * from t1 where btn like "q%";
btn
alter table t1 add column new_col char(1) not null, add key (btn,new_col), drop key btn;
update t1 set new_col=btn;
explain select * from t1 where btn="a";
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ALL btn NULL NULL NULL 14 where used
+1 SIMPLE t1 ALL btn NULL NULL NULL 14 Using where
explain select * from t1 where btn="a" and new_col="a";
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ref btn btn 11 const,const 10 where used
+1 SIMPLE t1 ref btn btn 11 const,const 10 Using where
drop table t1;
CREATE TABLE t1 (
a int default NULL,
@@ -182,7 +182,7 @@ SELECT * FROM t1 WHERE a=NULL;
a b
explain SELECT * FROM t1 WHERE a IS NULL;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ref a a 5 const 10 where used
+1 SIMPLE t1 ref a a 5 const 10 Using where
SELECT * FROM t1 WHERE a<=>NULL;
a b
NULL 99
@@ -190,7 +190,7 @@ SELECT * FROM t1 WHERE b=NULL;
a b
explain SELECT * FROM t1 WHERE b IS NULL;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ref b b 5 const 1 where used
+1 SIMPLE t1 ref b b 5 const 1 Using where
SELECT * FROM t1 WHERE b<=>NULL;
a b
99 NULL
diff --git a/mysql-test/r/innodb.result b/mysql-test/r/innodb.result
index 8f139799577..81064143872 100644
--- a/mysql-test/r/innodb.result
+++ b/mysql-test/r/innodb.result
@@ -140,13 +140,13 @@ id parent_id level
1015 102 2
explain select level from t1 where level=1;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ref level level 1 const 12 where used; Using index
+1 SIMPLE t1 ref level level 1 const 12 Using where; Using index
explain select level,id from t1 where level=1;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ref level level 1 const 12 where used; Using index
+1 SIMPLE t1 ref level level 1 const 12 Using where; Using index
explain select level,id,parent_id from t1 where level=1;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ref level level 1 const 12 where used
+1 SIMPLE t1 ref level level 1 const 12 Using where
select level,id from t1 where level=1;
level id
1 1002
@@ -165,7 +165,7 @@ level id parent_id
1 1007 101
optimize table t1;
Table Op Msg_type Msg_text
-test.t1 optimize error The handler for the table doesn't support check/repair
+test.t1 optimize error The handler for the table doesn't support optimize
show keys from t1;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
t1 0 PRIMARY 1 id A 87 NULL NULL BTREE
@@ -189,7 +189,7 @@ create table t1 (a int) type=innodb;
insert into t1 values (1), (2);
optimize table t1;
Table Op Msg_type Msg_text
-test.t1 optimize error The handler for the table doesn't support check/repair
+test.t1 optimize error The handler for the table doesn't support optimize
delete from t1 where a = 1;
select * from t1;
a
@@ -208,7 +208,7 @@ create index skr on t1 (a);
insert into t1 values (3,""), (4,"testing");
analyze table t1;
Table Op Msg_type Msg_text
-test.t1 analyze error The handler for the table doesn't support check/repair
+test.t1 analyze error The handler for the table doesn't support analyze
show keys from t1;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
t1 1 skr 1 a A 3 NULL NULL YES BTREE
@@ -597,7 +597,7 @@ id parent_id level
1016 102 2
explain select level from t1 where level=1;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ref level level 1 const 6 where used; Using index
+1 SIMPLE t1 ref level level 1 const 6 Using where; Using index
select level,id from t1 where level=1;
level id
1 1004
@@ -724,7 +724,7 @@ world 2
hello 1
optimize table t1;
Table Op Msg_type Msg_text
-test.t1 optimize error The handler for the table doesn't support check/repair
+test.t1 optimize error The handler for the table doesn't support optimize
show keys from t1;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
t1 0 PRIMARY 1 a A 2 NULL NULL BTREE
@@ -759,7 +759,7 @@ create table t1 (a int primary key,b int, c int, d int, e int, f int, g int, h
insert into t1 values (1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1);
explain select * from t1 where a > 0 and a < 50;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL 1 where used
+1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL 1 Using where
drop table t1;
create table t1 (id int NOT NULL,id2 int NOT NULL,id3 int NOT NULL,dummy1 char(30),primary key (id,id2),index index_id3 (id3)) type=innodb;
insert into t1 values (0,0,0,'ABCDEFGHIJ'),(2,2,2,'BCDEFGHIJK'),(1,1,1,'CDEFGHIJKL');
@@ -988,7 +988,7 @@ BEGIN;
SET SESSION TRANSACTION ISOLATION LEVEL SERIALIZABLE;
SELECT @@tx_isolation,@@global.tx_isolation;
@@tx_isolation @@global.tx_isolation
-SERIALIZABLE READ-COMMITTED
+SERIALIZABLE REPEATABLE-READ
insert into t1 (code, name) values (1, 'Tim'), (1, 'Monty'), (2, 'David');
select id, code, name from t1 order by id;
id code name
diff --git a/mysql-test/r/isam.result b/mysql-test/r/isam.result
index 5cb218dc4ce..e8f7898f1eb 100644
--- a/mysql-test/r/isam.result
+++ b/mysql-test/r/isam.result
@@ -47,14 +47,14 @@ test.t1 optimize status OK
check table t1,t2;
Table Op Msg_type Msg_text
test.t1 check status OK
-test.t2 check error The handler for the table doesn't support check/repair
+test.t2 check error The handler for the table doesn't support check
repair table t1,t2;
Table Op Msg_type Msg_text
test.t1 repair status OK
-test.t2 repair error The handler for the table doesn't support check/repair
+test.t2 repair error The handler for the table doesn't support repair
check table t2,t1;
Table Op Msg_type Msg_text
-test.t2 check error The handler for the table doesn't support check/repair
+test.t2 check error The handler for the table doesn't support check
test.t1 check status OK
lock tables t1 write;
check table t2,t1;
diff --git a/mysql-test/r/join_outer.result b/mysql-test/r/join_outer.result
index 9c44792724b..700b73d3eca 100644
--- a/mysql-test/r/join_outer.result
+++ b/mysql-test/r/join_outer.result
@@ -95,7 +95,7 @@ id select_type table type possible_keys key key_len ref rows Extra
explain select t1.*,t2.* from t1 left join t2 on t1.a=t2.a where isnull(t2.a)=1;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 7
-1 SIMPLE t2 eq_ref PRIMARY PRIMARY 8 t1.a 1 where used
+1 SIMPLE t2 eq_ref PRIMARY PRIMARY 8 t1.a 1 Using where
select t1.*,t2.*,t3.a from t1 left join t2 on (t1.a=t2.a) left join t1 as t3 on (t2.a=t3.a);
grp a c id a c d a
1 1 a 1 1 a 1 1
@@ -313,11 +313,11 @@ Lilliana Angelovska NULL NULL
explain select t1.name, t2.name, t2.id from t1 left join t2 on (t1.id = t2.owner) where t2.id is null;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 3
-1 SIMPLE t2 ALL NULL NULL NULL NULL 3 where used; Not exists
+1 SIMPLE t2 ALL NULL NULL NULL NULL 3 Using where; Not exists
explain select t1.name, t2.name, t2.id from t1 left join t2 on (t1.id = t2.owner) where t2.name is null;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 3
-1 SIMPLE t2 ALL NULL NULL NULL NULL 3 where used
+1 SIMPLE t2 ALL NULL NULL NULL NULL 3 Using where
select count(*) from t1 left join t2 on (t1.id = t2.owner);
count(*)
4
@@ -333,11 +333,11 @@ Lilliana Angelovska NULL NULL
explain select t1.name, t2.name, t2.id from t2 right join t1 on (t1.id = t2.owner) where t2.id is null;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 3
-1 SIMPLE t2 ALL NULL NULL NULL NULL 3 where used; Not exists
+1 SIMPLE t2 ALL NULL NULL NULL NULL 3 Using where; Not exists
explain select t1.name, t2.name, t2.id from t2 right join t1 on (t1.id = t2.owner) where t2.name is null;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 3
-1 SIMPLE t2 ALL NULL NULL NULL NULL 3 where used
+1 SIMPLE t2 ALL NULL NULL NULL NULL 3 Using where
select count(*) from t2 right join t1 on (t1.id = t2.owner);
count(*)
4
@@ -620,7 +620,7 @@ INSERT INTO t2 VALUES (1,1);
explain SELECT * from t1 left join t2 on t1.id=t2.id where t2.id IS NULL;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2
-1 SIMPLE t2 index id id 8 NULL 1 where used; Using index; Not exists
+1 SIMPLE t2 index id id 8 NULL 1 Using where; Using index; Not exists
SELECT * from t1 left join t2 on t1.id=t2.id where t2.id IS NULL;
id name id idx
2 no NULL NULL
@@ -640,7 +640,7 @@ insert into t2 values (10,1),(20,2),(30,3);
explain select * from t2 left join t1 on t1.fooID = t2.fooID and t1.fooID = 30;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 index NULL PRIMARY 4 NULL 3 Using index
-1 SIMPLE t1 eq_ref PRIMARY PRIMARY 2 const 1 where used; Using index
+1 SIMPLE t1 eq_ref PRIMARY PRIMARY 2 const 1 Using where; Using index
select * from t2 left join t1 on t1.fooID = t2.fooID and t1.fooID = 30;
fooID barID fooID
10 1 NULL
diff --git a/mysql-test/r/key_diff.result b/mysql-test/r/key_diff.result
index bdeff4f60d8..8097186bde1 100644
--- a/mysql-test/r/key_diff.result
+++ b/mysql-test/r/key_diff.result
@@ -36,7 +36,7 @@ a a a a
explain select t1.*,t2.* from t1,t1 as t2 where t1.A=t2.B;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL a NULL NULL NULL 5
-1 SIMPLE t2 ALL b NULL NULL NULL 5 where used
+1 SIMPLE t2 ALL b NULL NULL NULL 5 Using where
select t1.*,t2.* from t1,t1 as t2 where t1.A=t2.B order by binary t1.a,t2.a;
a b a b
A B a a
diff --git a/mysql-test/r/merge.result b/mysql-test/r/merge.result
index 27ce8e1d915..45b5bd9ddb7 100644
--- a/mysql-test/r/merge.result
+++ b/mysql-test/r/merge.result
@@ -35,10 +35,10 @@ insert into t1 select NULL,message from t2;
create table t3 (a int not null, b char(20), key(a)) type=MERGE UNION=(test.t1,test.t2);
explain select * from t3 where a < 10;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t3 range a a 4 NULL 10 where used
+1 SIMPLE t3 range a a 4 NULL 10 Using where
explain select * from t3 where a > 10 and a < 20;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t3 range a a 4 NULL 10 where used
+1 SIMPLE t3 range a a 4 NULL 10 Using where
select * from t3 where a = 10;
a b
10 Testing
@@ -541,3 +541,58 @@ select max(b) from t1 where a = 2;
max(b)
1
drop table if exists t,t1,t2;
+drop table if exists t1, t2, t3, t4, t5, t6;
+create table t1 (a int not null);
+create table t2 (a int not null);
+insert into t1 values (1);
+insert into t2 values (2);
+create temporary table t3 (a int not null) TYPE=MERGE UNION=(t1,t2);
+select * from t3;
+a
+1
+2
+create temporary table t4 (a int not null);
+create temporary table t5 (a int not null);
+insert into t4 values (1);
+insert into t5 values (2);
+create temporary table t6 (a int not null) TYPE=MERGE UNION=(t4,t5);
+select * from t6;
+a
+1
+2
+drop table if exists t1, t2, t3, t4, t5, t6;
+DROP TABLE IF EXISTS t1, t2;
+CREATE TABLE t1 (
+fileset_id tinyint(3) unsigned NOT NULL default '0',
+file_code varchar(32) NOT NULL default '',
+fileset_root_id tinyint(3) unsigned NOT NULL default '0',
+PRIMARY KEY (fileset_id,file_code),
+KEY files (fileset_id,fileset_root_id)
+) TYPE=MyISAM;
+INSERT INTO t1 VALUES (2, '0000000111', 1), (2, '0000000112', 1), (2, '0000000113', 1),
+(2, '0000000114', 1), (2, '0000000115', 1), (2, '0000000116', 1), (2, '0000000117', 1),
+(2, '0000000118', 1), (2, '0000000119', 1), (2, '0000000120', 1);
+CREATE TABLE t2 (
+fileset_id tinyint(3) unsigned NOT NULL default '0',
+file_code varchar(32) NOT NULL default '',
+fileset_root_id tinyint(3) unsigned NOT NULL default '0',
+PRIMARY KEY (fileset_id,file_code),
+KEY files (fileset_id,fileset_root_id)
+) TYPE=MRG_MyISAM UNION=(t1);
+EXPLAIN SELECT * FROM t2 IGNORE INDEX (files) WHERE fileset_id = 2
+AND file_code BETWEEN '0000000115' AND '0000000120' LIMIT 1;
+table type possible_keys key key_len ref rows Extra
+t2 range PRIMARY PRIMARY 33 NULL 5 Using where
+EXPLAIN SELECT * FROM t2 WHERE fileset_id = 2
+AND file_code BETWEEN '0000000115' AND '0000000120' LIMIT 1;
+table type possible_keys key key_len ref rows Extra
+t2 range PRIMARY,files PRIMARY 33 NULL 5 Using where
+EXPLAIN SELECT * FROM t1 WHERE fileset_id = 2
+AND file_code BETWEEN '0000000115' AND '0000000120' LIMIT 1;
+table type possible_keys key key_len ref rows Extra
+t1 range PRIMARY,files PRIMARY 33 NULL 5 Using where
+EXPLAIN SELECT * FROM t2 WHERE fileset_id = 2
+AND file_code = '0000000115' LIMIT 1;
+table type possible_keys key key_len ref rows Extra
+t2 const PRIMARY,files PRIMARY 33 const,const 1
+DROP TABLE IF EXISTS t1, t2;
diff --git a/mysql-test/r/multi_update.result b/mysql-test/r/multi_update.result
index 9dff4fba825..ce3f7e90f6b 100644
--- a/mysql-test/r/multi_update.result
+++ b/mysql-test/r/multi_update.result
@@ -150,4 +150,29 @@ n n
delete t1,t2 from t2 left outer join t1 using (n);
select * from t2 left outer join t1 using (n);
n n
-drop table if exists t1,t2 ;
+drop table t1,t2 ;
+create table t1 (n int(10) not null primary key, d int(10));
+create table t2 (n int(10) not null primary key, d int(10));
+insert into t1 values(1,1);
+insert into t2 values(1,10),(2,20);
+LOCK TABLES t1 write, t2 read;
+DELETE t1.*, t2.* FROM t1,t2 where t1.n=t2.n;
+Table 't2' was locked with a READ lock and can't be updated
+UPDATE t1,t2 SET t1.d=t2.d,t2.d=30 WHERE t1.n=t2.n;
+Table 't2' was locked with a READ lock and can't be updated
+UPDATE t1,t2 SET t1.d=t2.d WHERE t1.n=t2.n;
+Table 't2' was locked with a READ lock and can't be updated
+unlock tables;
+LOCK TABLES t1 write, t2 write;
+UPDATE t1,t2 SET t1.d=t2.d WHERE t1.n=t2.n;
+select * from t1;
+n d
+1 10
+DELETE t1.*, t2.* FROM t1,t2 where t1.n=t2.n;
+select * from t1;
+n d
+select * from t2;
+n d
+2 20
+unlock tables;
+drop table t1,t2;
diff --git a/mysql-test/r/myisam.result b/mysql-test/r/myisam.result
index 29818f28c45..6b9c3a53305 100644
--- a/mysql-test/r/myisam.result
+++ b/mysql-test/r/myisam.result
@@ -75,6 +75,218 @@ explain select a,b,c from t1;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 4
drop table t1;
+CREATE TABLE t1 (a INT);
+INSERT INTO t1 VALUES (1), (2), (3);
+LOCK TABLES t1 WRITE;
+INSERT INTO t1 VALUES (1), (2), (3);
+OPTIMIZE TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 optimize status OK
+DROP TABLE t1;
+drop table if exists t1;
+create table t1 ( t1 char(255), key(t1(250)));
+insert t1 values ('137513751375137513751375137513751375137569516951695169516951695169516951695169');
+insert t1 values ('178417841784178417841784178417841784178403420342034203420342034203420342034203');
+insert t1 values ('213872387238723872387238723872387238723867376737673767376737673767376737673767');
+insert t1 values ('242624262426242624262426242624262426242607890789078907890789078907890789078907');
+insert t1 values ('256025602560256025602560256025602560256011701170117011701170117011701170117011');
+insert t1 values ('276027602760276027602760276027602760276001610161016101610161016101610161016101');
+insert t1 values ('281528152815281528152815281528152815281564956495649564956495649564956495649564');
+insert t1 values ('292129212921292129212921292129212921292102100210021002100210021002100210021002');
+insert t1 values ('380638063806380638063806380638063806380634483448344834483448344834483448344834');
+insert t1 values ('411641164116411641164116411641164116411616301630163016301630163016301630163016');
+insert t1 values ('420842084208420842084208420842084208420899889988998899889988998899889988998899');
+insert t1 values ('438443844384438443844384438443844384438482448244824482448244824482448244824482');
+insert t1 values ('443244324432443244324432443244324432443239613961396139613961396139613961396139');
+insert t1 values ('485448544854485448544854485448544854485477847784778477847784778477847784778477');
+insert t1 values ('494549454945494549454945494549454945494555275527552755275527552755275527552755');
+insert t1 values ('538647864786478647864786478647864786478688918891889188918891889188918891889188');
+insert t1 values ('565556555655565556555655565556555655565554845484548454845484548454845484548454');
+insert t1 values ('607860786078607860786078607860786078607856665666566656665666566656665666566656');
+insert t1 values ('640164016401640164016401640164016401640141274127412741274127412741274127412741');
+insert t1 values ('719471947194719471947194719471947194719478717871787178717871787178717871787178');
+insert t1 values ('742574257425742574257425742574257425742549604960496049604960496049604960496049');
+insert t1 values ('887088708870887088708870887088708870887035963596359635963596359635963596359635');
+insert t1 values ('917791779177917791779177917791779177917773857385738573857385738573857385738573');
+insert t1 values ('933293329332933293329332933293329332933278987898789878987898789878987898789878');
+insert t1 values ('963896389638963896389638963896389638963877807780778077807780778077807780778077');
+delete from t1 where t1>'2';
+insert t1 values ('70'), ('84'), ('60'), ('20'), ('76'), ('89'), ('49'), ('50'),
+('88'), ('61'), ('42'), ('98'), ('39'), ('30'), ('25'), ('66'), ('61'), ('48'),
+('80'), ('84'), ('98'), ('19'), ('91'), ('42'), ('47');
+optimize table t1;
+Table Op Msg_type Msg_text
+test.t1 optimize status OK
+check table t1;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+drop table t1;
+drop table if exists t1;
+create table t1 (i1 int, i2 int, i3 int, i4 int, i5 int, i6 int, i7 int, i8
+int, i9 int, i10 int, i11 int, i12 int, i13 int, i14 int, i15 int, i16 int, i17
+int, i18 int, i19 int, i20 int, i21 int, i22 int, i23 int, i24 int, i25 int,
+i26 int, i27 int, i28 int, i29 int, i30 int, i31 int, i32 int, i33 int, i34
+int, i35 int, i36 int, i37 int, i38 int, i39 int, i40 int, i41 int, i42 int,
+i43 int, i44 int, i45 int, i46 int, i47 int, i48 int, i49 int, i50 int, i51
+int, i52 int, i53 int, i54 int, i55 int, i56 int, i57 int, i58 int, i59 int,
+i60 int, i61 int, i62 int, i63 int, i64 int, i65 int, i66 int, i67 int, i68
+int, i69 int, i70 int, i71 int, i72 int, i73 int, i74 int, i75 int, i76 int,
+i77 int, i78 int, i79 int, i80 int, i81 int, i82 int, i83 int, i84 int, i85
+int, i86 int, i87 int, i88 int, i89 int, i90 int, i91 int, i92 int, i93 int,
+i94 int, i95 int, i96 int, i97 int, i98 int, i99 int, i100 int, i101 int, i102
+int, i103 int, i104 int, i105 int, i106 int, i107 int, i108 int, i109 int, i110
+int, i111 int, i112 int, i113 int, i114 int, i115 int, i116 int, i117 int, i118
+int, i119 int, i120 int, i121 int, i122 int, i123 int, i124 int, i125 int, i126
+int, i127 int, i128 int, i129 int, i130 int, i131 int, i132 int, i133 int, i134
+int, i135 int, i136 int, i137 int, i138 int, i139 int, i140 int, i141 int, i142
+int, i143 int, i144 int, i145 int, i146 int, i147 int, i148 int, i149 int, i150
+int, i151 int, i152 int, i153 int, i154 int, i155 int, i156 int, i157 int, i158
+int, i159 int, i160 int, i161 int, i162 int, i163 int, i164 int, i165 int, i166
+int, i167 int, i168 int, i169 int, i170 int, i171 int, i172 int, i173 int, i174
+int, i175 int, i176 int, i177 int, i178 int, i179 int, i180 int, i181 int, i182
+int, i183 int, i184 int, i185 int, i186 int, i187 int, i188 int, i189 int, i190
+int, i191 int, i192 int, i193 int, i194 int, i195 int, i196 int, i197 int, i198
+int, i199 int, i200 int, i201 int, i202 int, i203 int, i204 int, i205 int, i206
+int, i207 int, i208 int, i209 int, i210 int, i211 int, i212 int, i213 int, i214
+int, i215 int, i216 int, i217 int, i218 int, i219 int, i220 int, i221 int, i222
+int, i223 int, i224 int, i225 int, i226 int, i227 int, i228 int, i229 int, i230
+int, i231 int, i232 int, i233 int, i234 int, i235 int, i236 int, i237 int, i238
+int, i239 int, i240 int, i241 int, i242 int, i243 int, i244 int, i245 int, i246
+int, i247 int, i248 int, i249 int, i250 int, i251 int, i252 int, i253 int, i254
+int, i255 int, i256 int, i257 int, i258 int, i259 int, i260 int, i261 int, i262
+int, i263 int, i264 int, i265 int, i266 int, i267 int, i268 int, i269 int, i270
+int, i271 int, i272 int, i273 int, i274 int, i275 int, i276 int, i277 int, i278
+int, i279 int, i280 int, i281 int, i282 int, i283 int, i284 int, i285 int, i286
+int, i287 int, i288 int, i289 int, i290 int, i291 int, i292 int, i293 int, i294
+int, i295 int, i296 int, i297 int, i298 int, i299 int, i300 int, i301 int, i302
+int, i303 int, i304 int, i305 int, i306 int, i307 int, i308 int, i309 int, i310
+int, i311 int, i312 int, i313 int, i314 int, i315 int, i316 int, i317 int, i318
+int, i319 int, i320 int, i321 int, i322 int, i323 int, i324 int, i325 int, i326
+int, i327 int, i328 int, i329 int, i330 int, i331 int, i332 int, i333 int, i334
+int, i335 int, i336 int, i337 int, i338 int, i339 int, i340 int, i341 int, i342
+int, i343 int, i344 int, i345 int, i346 int, i347 int, i348 int, i349 int, i350
+int, i351 int, i352 int, i353 int, i354 int, i355 int, i356 int, i357 int, i358
+int, i359 int, i360 int, i361 int, i362 int, i363 int, i364 int, i365 int, i366
+int, i367 int, i368 int, i369 int, i370 int, i371 int, i372 int, i373 int, i374
+int, i375 int, i376 int, i377 int, i378 int, i379 int, i380 int, i381 int, i382
+int, i383 int, i384 int, i385 int, i386 int, i387 int, i388 int, i389 int, i390
+int, i391 int, i392 int, i393 int, i394 int, i395 int, i396 int, i397 int, i398
+int, i399 int, i400 int, i401 int, i402 int, i403 int, i404 int, i405 int, i406
+int, i407 int, i408 int, i409 int, i410 int, i411 int, i412 int, i413 int, i414
+int, i415 int, i416 int, i417 int, i418 int, i419 int, i420 int, i421 int, i422
+int, i423 int, i424 int, i425 int, i426 int, i427 int, i428 int, i429 int, i430
+int, i431 int, i432 int, i433 int, i434 int, i435 int, i436 int, i437 int, i438
+int, i439 int, i440 int, i441 int, i442 int, i443 int, i444 int, i445 int, i446
+int, i447 int, i448 int, i449 int, i450 int, i451 int, i452 int, i453 int, i454
+int, i455 int, i456 int, i457 int, i458 int, i459 int, i460 int, i461 int, i462
+int, i463 int, i464 int, i465 int, i466 int, i467 int, i468 int, i469 int, i470
+int, i471 int, i472 int, i473 int, i474 int, i475 int, i476 int, i477 int, i478
+int, i479 int, i480 int, i481 int, i482 int, i483 int, i484 int, i485 int, i486
+int, i487 int, i488 int, i489 int, i490 int, i491 int, i492 int, i493 int, i494
+int, i495 int, i496 int, i497 int, i498 int, i499 int, i500 int, i501 int, i502
+int, i503 int, i504 int, i505 int, i506 int, i507 int, i508 int, i509 int, i510
+int, i511 int, i512 int, i513 int, i514 int, i515 int, i516 int, i517 int, i518
+int, i519 int, i520 int, i521 int, i522 int, i523 int, i524 int, i525 int, i526
+int, i527 int, i528 int, i529 int, i530 int, i531 int, i532 int, i533 int, i534
+int, i535 int, i536 int, i537 int, i538 int, i539 int, i540 int, i541 int, i542
+int, i543 int, i544 int, i545 int, i546 int, i547 int, i548 int, i549 int, i550
+int, i551 int, i552 int, i553 int, i554 int, i555 int, i556 int, i557 int, i558
+int, i559 int, i560 int, i561 int, i562 int, i563 int, i564 int, i565 int, i566
+int, i567 int, i568 int, i569 int, i570 int, i571 int, i572 int, i573 int, i574
+int, i575 int, i576 int, i577 int, i578 int, i579 int, i580 int, i581 int, i582
+int, i583 int, i584 int, i585 int, i586 int, i587 int, i588 int, i589 int, i590
+int, i591 int, i592 int, i593 int, i594 int, i595 int, i596 int, i597 int, i598
+int, i599 int, i600 int, i601 int, i602 int, i603 int, i604 int, i605 int, i606
+int, i607 int, i608 int, i609 int, i610 int, i611 int, i612 int, i613 int, i614
+int, i615 int, i616 int, i617 int, i618 int, i619 int, i620 int, i621 int, i622
+int, i623 int, i624 int, i625 int, i626 int, i627 int, i628 int, i629 int, i630
+int, i631 int, i632 int, i633 int, i634 int, i635 int, i636 int, i637 int, i638
+int, i639 int, i640 int, i641 int, i642 int, i643 int, i644 int, i645 int, i646
+int, i647 int, i648 int, i649 int, i650 int, i651 int, i652 int, i653 int, i654
+int, i655 int, i656 int, i657 int, i658 int, i659 int, i660 int, i661 int, i662
+int, i663 int, i664 int, i665 int, i666 int, i667 int, i668 int, i669 int, i670
+int, i671 int, i672 int, i673 int, i674 int, i675 int, i676 int, i677 int, i678
+int, i679 int, i680 int, i681 int, i682 int, i683 int, i684 int, i685 int, i686
+int, i687 int, i688 int, i689 int, i690 int, i691 int, i692 int, i693 int, i694
+int, i695 int, i696 int, i697 int, i698 int, i699 int, i700 int, i701 int, i702
+int, i703 int, i704 int, i705 int, i706 int, i707 int, i708 int, i709 int, i710
+int, i711 int, i712 int, i713 int, i714 int, i715 int, i716 int, i717 int, i718
+int, i719 int, i720 int, i721 int, i722 int, i723 int, i724 int, i725 int, i726
+int, i727 int, i728 int, i729 int, i730 int, i731 int, i732 int, i733 int, i734
+int, i735 int, i736 int, i737 int, i738 int, i739 int, i740 int, i741 int, i742
+int, i743 int, i744 int, i745 int, i746 int, i747 int, i748 int, i749 int, i750
+int, i751 int, i752 int, i753 int, i754 int, i755 int, i756 int, i757 int, i758
+int, i759 int, i760 int, i761 int, i762 int, i763 int, i764 int, i765 int, i766
+int, i767 int, i768 int, i769 int, i770 int, i771 int, i772 int, i773 int, i774
+int, i775 int, i776 int, i777 int, i778 int, i779 int, i780 int, i781 int, i782
+int, i783 int, i784 int, i785 int, i786 int, i787 int, i788 int, i789 int, i790
+int, i791 int, i792 int, i793 int, i794 int, i795 int, i796 int, i797 int, i798
+int, i799 int, i800 int, i801 int, i802 int, i803 int, i804 int, i805 int, i806
+int, i807 int, i808 int, i809 int, i810 int, i811 int, i812 int, i813 int, i814
+int, i815 int, i816 int, i817 int, i818 int, i819 int, i820 int, i821 int, i822
+int, i823 int, i824 int, i825 int, i826 int, i827 int, i828 int, i829 int, i830
+int, i831 int, i832 int, i833 int, i834 int, i835 int, i836 int, i837 int, i838
+int, i839 int, i840 int, i841 int, i842 int, i843 int, i844 int, i845 int, i846
+int, i847 int, i848 int, i849 int, i850 int, i851 int, i852 int, i853 int, i854
+int, i855 int, i856 int, i857 int, i858 int, i859 int, i860 int, i861 int, i862
+int, i863 int, i864 int, i865 int, i866 int, i867 int, i868 int, i869 int, i870
+int, i871 int, i872 int, i873 int, i874 int, i875 int, i876 int, i877 int, i878
+int, i879 int, i880 int, i881 int, i882 int, i883 int, i884 int, i885 int, i886
+int, i887 int, i888 int, i889 int, i890 int, i891 int, i892 int, i893 int, i894
+int, i895 int, i896 int, i897 int, i898 int, i899 int, i900 int, i901 int, i902
+int, i903 int, i904 int, i905 int, i906 int, i907 int, i908 int, i909 int, i910
+int, i911 int, i912 int, i913 int, i914 int, i915 int, i916 int, i917 int, i918
+int, i919 int, i920 int, i921 int, i922 int, i923 int, i924 int, i925 int, i926
+int, i927 int, i928 int, i929 int, i930 int, i931 int, i932 int, i933 int, i934
+int, i935 int, i936 int, i937 int, i938 int, i939 int, i940 int, i941 int, i942
+int, i943 int, i944 int, i945 int, i946 int, i947 int, i948 int, i949 int, i950
+int, i951 int, i952 int, i953 int, i954 int, i955 int, i956 int, i957 int, i958
+int, i959 int, i960 int, i961 int, i962 int, i963 int, i964 int, i965 int, i966
+int, i967 int, i968 int, i969 int, i970 int, i971 int, i972 int, i973 int, i974
+int, i975 int, i976 int, i977 int, i978 int, i979 int, i980 int, i981 int, i982
+int, i983 int, i984 int, i985 int, i986 int, i987 int, i988 int, i989 int, i990
+int, i991 int, i992 int, i993 int, i994 int, i995 int, i996 int, i997 int, i998
+int, i999 int, i1000 int) row_format=dynamic;
+insert into t1 values (1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1);
+drop table if exists t1;
CREATE TABLE `t1` (
`post_id` mediumint(8) unsigned NOT NULL auto_increment,
`topic_id` mediumint(8) unsigned NOT NULL default '0',
@@ -100,14 +312,6 @@ CHECK TABLE t1;
Table Op Msg_type Msg_text
test.t1 check status OK
drop table t1;
-CREATE TABLE t1 (a INT);
-INSERT INTO t1 VALUES (1), (2), (3);
-LOCK TABLES t1 WRITE;
-INSERT INTO t1 VALUES (1), (2), (3);
-OPTIMIZE TABLE t1;
-Table Op Msg_type Msg_text
-test.t1 optimize status OK
-DROP TABLE t1;
CREATE TABLE t1 (a varchar(255), b varchar(255), c varchar(255), KEY t1 (a, b, c));
Specified key was too long. Max key length is 500
CREATE TABLE t1 (a varchar(255), b varchar(255), c varchar(255));
diff --git a/mysql-test/r/null.result b/mysql-test/r/null.result
index e6e3b7155a3..07724a56025 100644
--- a/mysql-test/r/null.result
+++ b/mysql-test/r/null.result
@@ -30,7 +30,7 @@ SELECT (NULL OR NULL) IS NULL;
1
select NULL AND 0, 0 and NULL;
NULL AND 0 0 and NULL
-NULL 0
+0 0
select inet_ntoa(null),inet_aton(null),inet_aton("122.256"),inet_aton("122.226."),inet_aton("");
inet_ntoa(null) inet_aton(null) inet_aton("122.256") inet_aton("122.226.") inet_aton("")
NULL NULL NULL NULL NULL
diff --git a/mysql-test/r/null_key.result b/mysql-test/r/null_key.result
index cbc8b913f45..85687df411b 100644
--- a/mysql-test/r/null_key.result
+++ b/mysql-test/r/null_key.result
@@ -3,37 +3,37 @@ create table t1 (a int, b int not null,unique key (a,b),index(b)) type=myisam;
insert ignore into t1 values (1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(null,7),(9,9),(8,8),(7,7),(null,9),(null,9),(6,6);
explain select * from t1 where a is null;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ref a a 5 const 3 where used; Using index
+1 SIMPLE t1 ref a a 5 const 3 Using where; Using index
explain select * from t1 where a is null and b = 2;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ref a,b a 9 const,const 1 where used; Using index
+1 SIMPLE t1 ref a,b a 9 const,const 1 Using where; Using index
explain select * from t1 where a is null and b = 7;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ref a,b a 9 const,const 1 where used; Using index
+1 SIMPLE t1 ref a,b a 9 const,const 1 Using where; Using index
explain select * from t1 where a=2 and b = 2;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 const a,b a 9 const,const 1
explain select * from t1 where a<=>b limit 2;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 index NULL a 9 NULL 12 where used; Using index
+1 SIMPLE t1 index NULL a 9 NULL 12 Using where; Using index
explain select * from t1 where (a is null or a > 0 and a < 3) and b < 5 limit 3;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range a,b a 9 NULL 3 where used; Using index
+1 SIMPLE t1 range a,b a 9 NULL 3 Using where; Using index
explain select * from t1 where (a is null or a = 7) and b=7;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ref a,b b 4 const 2 where used
+1 SIMPLE t1 ref a,b b 4 const 2 Using where
explain select * from t1 where (a is null and b>a) or a is null and b=7 limit 2;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ref a,b a 5 const 3 where used; Using index
+1 SIMPLE t1 ref a,b a 5 const 3 Using where; Using index
explain select * from t1 where a is null and b=9 or a is null and b=7 limit 3;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range a,b a 9 NULL 2 where used; Using index
+1 SIMPLE t1 range a,b a 9 NULL 2 Using where; Using index
explain select * from t1 where a > 1 and a < 3 limit 1;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range a a 5 NULL 1 where used; Using index
+1 SIMPLE t1 range a a 5 NULL 1 Using where; Using index
explain select * from t1 where a > 8 and a < 9;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range a a 5 NULL 1 where used; Using index
+1 SIMPLE t1 range a a 5 NULL 1 Using where; Using index
select * from t1 where a is null;
a b
NULL 7
@@ -66,43 +66,43 @@ NULL 9
alter table t1 modify b blob not null, add c int not null, drop key a, add unique key (a,b(20),c), drop key b, add key (b(10));
explain select * from t1 where a is null and b = 2;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ref a,b a 5 const 3 where used
+1 SIMPLE t1 ref a,b a 5 const 3 Using where
explain select * from t1 where a is null and b = 2 and c=0;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ref a,b a 5 const 3 where used
+1 SIMPLE t1 ref a,b a 5 const 3 Using where
explain select * from t1 where a is null and b = 7 and c=0;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ref a,b a 5 const 3 where used
+1 SIMPLE t1 ref a,b a 5 const 3 Using where
explain select * from t1 where a=2 and b = 2;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ref a,b a 5 const 1 where used
+1 SIMPLE t1 ref a,b a 5 const 1 Using where
explain select * from t1 where a<=>b limit 2;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ALL NULL NULL NULL NULL 12 where used
+1 SIMPLE t1 ALL NULL NULL NULL NULL 12 Using where
explain select * from t1 where (a is null or a > 0 and a < 3) and b < 5 and c=0 limit 3;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range a,b a 5 NULL 5 where used
+1 SIMPLE t1 range a,b a 5 NULL 5 Using where
explain select * from t1 where (a is null or a = 7) and b=7 and c=0;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range a,b a 5 NULL 4 where used
+1 SIMPLE t1 range a,b a 5 NULL 4 Using where
explain select * from t1 where (a is null and b>a) or a is null and b=7 limit 2;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ref a,b a 5 const 3 where used
+1 SIMPLE t1 ref a,b a 5 const 3 Using where
explain select * from t1 where a is null and b=9 or a is null and b=7 limit 3;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ref a,b a 5 const 3 where used
+1 SIMPLE t1 ref a,b a 5 const 3 Using where
explain select * from t1 where a > 1 and a < 3 limit 1;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range a a 5 NULL 1 where used
+1 SIMPLE t1 range a a 5 NULL 1 Using where
explain select * from t1 where a is null and b=7 or a > 1 and a < 3 limit 1;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range a,b a 5 NULL 4 where used
+1 SIMPLE t1 range a,b a 5 NULL 4 Using where
explain select * from t1 where a > 8 and a < 9;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range a a 5 NULL 1 where used
+1 SIMPLE t1 range a a 5 NULL 1 Using where
explain select * from t1 where b like "6%";
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range b b 12 NULL 1 where used
+1 SIMPLE t1 range b b 12 NULL 1 Using where
select * from t1 where a is null;
a b c
NULL 7 0
@@ -152,7 +152,7 @@ INSERT INTO t1 VALUES (1,NULL),(2,NULL),(3,1),(4,2),(5,NULL),(6,NULL),(7,3),(8,4
INSERT INTO t2 VALUES (1,NULL),(2,NULL),(3,1),(4,2),(5,NULL),(6,NULL),(7,3),(8,4),(9,NULL),(10,NULL);
explain select id from t1 where uniq_id is null;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ref idx1 idx1 5 const 1 where used
+1 SIMPLE t1 ref idx1 idx1 5 const 1 Using where
explain select id from t1 where uniq_id =1;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 const idx1 idx1 5 const 1
diff --git a/mysql-test/r/order_by.result b/mysql-test/r/order_by.result
index 64e2c9f5240..5645961a178 100644
--- a/mysql-test/r/order_by.result
+++ b/mysql-test/r/order_by.result
@@ -264,13 +264,13 @@ create table t1 (a int not null, b int, c varchar(10), key (a, b, c));
insert into t1 values (1, NULL, NULL), (1, NULL, 'b'), (1, 1, NULL), (1, 1, 'b'), (1, 1, 'b'), (2, 1, 'a'), (2, 1, 'b'), (2, 2, 'a'), (2, 2, 'b'), (2, 3, 'c'),(1,3,'b');
explain select * from t1 where (a = 1 and b is null and c = 'b') or (a > 2) order by a desc;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range a a 20 NULL 2 where used; Using index
+1 SIMPLE t1 range a a 20 NULL 2 Using where; Using index
select * from t1 where (a = 1 and b is null and c = 'b') or (a > 2) order by a desc;
a b c
1 NULL b
explain select * from t1 where a >= 1 and a < 3 order by a desc;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range a a 4 NULL 10 where used; Using index
+1 SIMPLE t1 range a a 4 NULL 10 Using where; Using index
select * from t1 where a >= 1 and a < 3 order by a desc;
a b c
2 3 c
@@ -286,7 +286,7 @@ a b c
1 NULL NULL
explain select * from t1 where a = 1 order by a desc, b desc;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ref a a 4 const 5 where used; Using index
+1 SIMPLE t1 ref a a 4 const 5 Using where; Using index
select * from t1 where a = 1 order by a desc, b desc;
a b c
1 3 b
@@ -297,30 +297,30 @@ a b c
1 NULL NULL
explain select * from t1 where a = 1 and b is null order by a desc, b desc;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ref a a 9 const,const 2 where used; Using index; Using filesort
+1 SIMPLE t1 ref a a 9 const,const 2 Using where; Using index; Using filesort
select * from t1 where a = 1 and b is null order by a desc, b desc;
a b c
1 NULL NULL
1 NULL b
explain select * from t1 where a >= 1 and a < 3 and b >0 order by a desc,b desc;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range a a 9 NULL 8 where used; Using index; Using filesort
+1 SIMPLE t1 range a a 9 NULL 8 Using where; Using index; Using filesort
explain select * from t1 where a = 2 and b >0 order by a desc,b desc;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range a a 9 NULL 5 where used; Using index
+1 SIMPLE t1 range a a 9 NULL 5 Using where; Using index
explain select * from t1 where a = 2 and b is null order by a desc,b desc;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ref a a 9 const,const 1 where used; Using index; Using filesort
+1 SIMPLE t1 ref a a 9 const,const 1 Using where; Using index; Using filesort
explain select * from t1 where a = 2 and (b is null or b > 0) order by a
desc,b desc;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range a a 9 NULL 6 where used; Using index
+1 SIMPLE t1 range a a 9 NULL 6 Using where; Using index
explain select * from t1 where a = 2 and b > 0 order by a desc,b desc;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range a a 9 NULL 5 where used; Using index
+1 SIMPLE t1 range a a 9 NULL 5 Using where; Using index
explain select * from t1 where a = 2 and b < 2 order by a desc,b desc;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range a a 9 NULL 2 where used; Using index; Using filesort
+1 SIMPLE t1 range a a 9 NULL 2 Using where; Using index; Using filesort
alter table t1 modify b int not null, modify c varchar(10) not null;
explain select * from t1 order by a, b, c;
id select_type table type possible_keys key key_len ref rows Extra
@@ -356,14 +356,14 @@ a b c
1 0
explain select * from t1 where (a = 1 and b = 1 and c = 'b') or (a > 2) order by a desc;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range a a 18 NULL 3 where used; Using index
+1 SIMPLE t1 range a a 18 NULL 3 Using where; Using index
select * from t1 where (a = 1 and b = 1 and c = 'b') or (a > 2) order by a desc;
a b c
1 1 b
1 1 b
explain select * from t1 where a < 2 and b <= 1 order by a desc, b desc;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range a a 4 NULL 6 where used; Using index
+1 SIMPLE t1 range a a 4 NULL 6 Using where; Using index
select * from t1 where a < 2 and b <= 1 order by a desc, b desc;
a b c
1 1 b
@@ -387,7 +387,7 @@ a b c
1 1
explain select * from t1 where a between 1 and 3 and b <= 1 order by a desc, b desc;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range a a 8 NULL 10 where used; Using index
+1 SIMPLE t1 range a a 8 NULL 10 Using where; Using index
select * from t1 where a between 1 and 3 and b <= 1 order by a desc, b desc;
a b c
2 1 b
@@ -399,7 +399,7 @@ a b c
1 0
explain select * from t1 where a between 0 and 1 order by a desc, b desc;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range a a 4 NULL 5 where used; Using index
+1 SIMPLE t1 range a a 4 NULL 5 Using where; Using index
select * from t1 where a between 0 and 1 order by a desc, b desc;
a b c
1 3 b
@@ -452,24 +452,24 @@ EXPLAIN select t1.gid, t2.sid, t3.uid from t3, t2, t1 where t2.gid = t1.gid and
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index PRIMARY PRIMARY 4 NULL 6 Using index
1 SIMPLE t2 eq_ref PRIMARY,uid PRIMARY 4 t1.gid 1
-1 SIMPLE t3 eq_ref PRIMARY PRIMARY 2 t2.uid 1 where used; Using index
+1 SIMPLE t3 eq_ref PRIMARY PRIMARY 2 t2.uid 1 Using where; Using index
EXPLAIN SELECT t1.gid, t3.uid from t1, t3 where t1.gid = t3.uid order by t1.gid,t3.skr;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index PRIMARY PRIMARY 4 NULL 6 Using index
-1 SIMPLE t3 eq_ref PRIMARY PRIMARY 2 t1.gid 1 where used
+1 SIMPLE t3 eq_ref PRIMARY PRIMARY 2 t1.gid 1 Using where
EXPLAIN SELECT t1.gid, t2.sid, t3.uid from t2, t1, t3 where t2.gid = t1.gid and t2.uid = t3.uid order by t3.uid, t1.gid;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index PRIMARY PRIMARY 4 NULL 6 Using index; Using temporary; Using filesort
1 SIMPLE t2 eq_ref PRIMARY,uid PRIMARY 4 t1.gid 1
-1 SIMPLE t3 eq_ref PRIMARY PRIMARY 2 t2.uid 1 where used; Using index
+1 SIMPLE t3 eq_ref PRIMARY PRIMARY 2 t2.uid 1 Using where; Using index
EXPLAIN SELECT t1.gid, t3.uid from t1, t3 where t1.gid = t3.uid order by t3.skr,t1.gid;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index PRIMARY PRIMARY 4 NULL 6 Using index; Using temporary; Using filesort
-1 SIMPLE t3 eq_ref PRIMARY PRIMARY 2 t1.gid 1 where used
+1 SIMPLE t3 eq_ref PRIMARY PRIMARY 2 t1.gid 1 Using where
EXPLAIN SELECT t1.gid, t3.uid from t1, t3 where t1.skr = t3.uid order by t1.gid,t3.skr;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 6 Using temporary; Using filesort
-1 SIMPLE t3 eq_ref PRIMARY PRIMARY 2 t1.skr 1 where used
+1 SIMPLE t3 eq_ref PRIMARY PRIMARY 2 t1.skr 1 Using where
drop table t1,t2,t3;
CREATE TABLE t1 (
`titre` char(80) NOT NULL default '',
diff --git a/mysql-test/r/query_cache.result b/mysql-test/r/query_cache.result
index a09f4608142..a37313a150a 100644
--- a/mysql-test/r/query_cache.result
+++ b/mysql-test/r/query_cache.result
@@ -320,6 +320,9 @@ insert into t1 select * from t2;
show status like "Qcache_hits";
Variable_name Value
Qcache_hits 4
+show status like "Qcache_lowmem_prunes";
+Variable_name Value
+Qcache_lowmem_prunes 0
select a as a1, a as a2 from t1;
select a as a2, a as a3 from t1;
select a as a3, a as a4 from t1;
@@ -330,6 +333,9 @@ Qcache_hits 4
show status like "Qcache_queries_in_cache";
Variable_name Value
Qcache_queries_in_cache 2
+show status like "Qcache_lowmem_prunes";
+Variable_name Value
+Qcache_lowmem_prunes 2
reset query cache;
insert into t2 select * from t1;
insert into t1 select * from t2;
diff --git a/mysql-test/r/rpl000007.result b/mysql-test/r/rpl000007.result
deleted file mode 100644
index 6889f6af2bc..00000000000
--- a/mysql-test/r/rpl000007.result
+++ /dev/null
@@ -1,20 +0,0 @@
-stop slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-reset master;
-reset slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-start slave;
-drop table if exists foo;
-create table foo (n int);
-insert into foo values(4);
-drop table if exists foo;
-create table foo (s char(20));
-load data infile '../../std_data/words.dat' into table foo;
-insert into foo values('five');
-drop table if exists bar;
-create table bar (m int);
-insert into bar values(15);
-select foo.n,bar.m from foo,bar;
-n m
-4 15
-drop table if exists bar,foo;
diff --git a/mysql-test/r/rpl_replicate_do.result b/mysql-test/r/rpl_replicate_do.result
new file mode 100644
index 00000000000..aabda54640c
--- /dev/null
+++ b/mysql-test/r/rpl_replicate_do.result
@@ -0,0 +1,28 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+drop table if exists t11;
+drop table if exists t11;
+create table t2 (n int);
+insert into t2 values(4);
+create table t2 (s char(20));
+load data infile '../../std_data/words.dat' into table t2;
+insert into t2 values('five');
+create table t1 (m int);
+insert into t1 values(15),(16),(17);
+update t1 set m=20 where m=16;
+delete from t1 where m=17;
+create table t11 select * from t1;
+select * from t1;
+m
+15
+20
+select * from t2;
+n
+4
+select * from t11;
+Table 'test.t11' doesn't exist
+drop table if exists t1,t2,t3,t11;
diff --git a/mysql-test/r/rpl_rotate_logs.result b/mysql-test/r/rpl_rotate_logs.result
index a5928edfaa3..2582b875daa 100644
--- a/mysql-test/r/rpl_rotate_logs.result
+++ b/mysql-test/r/rpl_rotate_logs.result
@@ -1,3 +1,5 @@
+drop table if exists t1, t2, t3, t4;
+drop table if exists t1, t2, t3, t4;
start slave;
Could not initialize master info structure, check permisions on master.info
start slave;
@@ -8,7 +10,6 @@ reset slave;
change master to master_host='127.0.0.1',master_port=MASTER_PORT, master_user='root';
reset master;
start slave;
-drop table if exists t1, t2, t3, t4;
create temporary table temp_table (a char(80) not null);
insert into temp_table values ("testing temporary tables");
create table t1 (s text);
diff --git a/mysql-test/r/select.result b/mysql-test/r/select.result
index 3a15e419fa5..2615ee542e3 100644
--- a/mysql-test/r/select.result
+++ b/mysql-test/r/select.result
@@ -1328,19 +1328,19 @@ select t2.fld3 from t2 where fld3 LIKE 'don_t_find_me_please%';
fld3
explain select t2.fld3 from t2 where fld3 = 'honeysuckle';
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t2 ref fld3 fld3 30 const 1 where used; Using index
+1 SIMPLE t2 ref fld3 fld3 30 const 1 Using where; Using index
explain select fld3 from t2 ignore index (fld3) where fld3 = 'honeysuckle';
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t2 index NULL fld3 30 NULL 1199 where used; Using index
+1 SIMPLE t2 index NULL fld3 30 NULL 1199 Using where; Using index
explain select fld3 from t2 use index (fld1) where fld3 = 'honeysuckle';
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t2 index NULL fld3 30 NULL 1199 where used; Using index
+1 SIMPLE t2 index NULL fld3 30 NULL 1199 Using where; Using index
explain select fld3 from t2 use index (fld3) where fld3 = 'honeysuckle';
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t2 ref fld3 fld3 30 const 1 where used; Using index
+1 SIMPLE t2 ref fld3 fld3 30 const 1 Using where; Using index
explain select fld3 from t2 use index (fld1,fld3) where fld3 = 'honeysuckle';
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t2 ref fld3 fld3 30 const 1 where used; Using index
+1 SIMPLE t2 ref fld3 fld3 30 const 1 Using where; Using index
explain select fld3 from t2 ignore index (fld3,not_used);
Key column 'not_used' doesn't exist in table
explain select fld3 from t2 use index (not_used);
@@ -1351,7 +1351,7 @@ honeysuckle
honoring
explain select t2.fld3 from t2 where fld3 >= 'honeysuckle' and fld3 <= 'honoring' order by fld3;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t2 range fld3 fld3 30 NULL 2 where used; Using index
+1 SIMPLE t2 range fld3 fld3 30 NULL 2 Using where; Using index
select fld1,fld3 from t2 where fld3="Colombo" or fld3 = "nondecreasing" order by fld3;
fld1 fld3
148504 Colombo
@@ -1371,7 +1371,7 @@ fld1
250502
explain select fld1 from t2 where fld1=250501 or fld1="250502";
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t2 range fld1 fld1 4 NULL 2 where used; Using index
+1 SIMPLE t2 range fld1 fld1 4 NULL 2 Using where; Using index
select fld1 from t2 where fld1=250501 or fld1=250502 or fld1 >= 250505 and fld1 <= 250601 or fld1 between 250501 and 250502;
fld1
250501
@@ -1380,7 +1380,7 @@ fld1
250601
explain select fld1 from t2 where fld1=250501 or fld1=250502 or fld1 >= 250505 and fld1 <= 250601 or fld1 between 250501 and 250502;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t2 range fld1 fld1 4 NULL 4 where used; Using index
+1 SIMPLE t2 range fld1 fld1 4 NULL 4 Using where; Using index
select fld1,fld3 from t2 where companynr = 37 and fld3 like 'f%';
fld1 fld3
218401 faithful
@@ -1807,8 +1807,8 @@ select distinct fld3 from t2,t3 where t2.companynr = 34 and t2.fld1=t3.t2nr orde
fld3
explain select t3.t2nr,fld3 from t2,t3 where t2.companynr = 34 and t2.fld1=t3.t2nr order by t3.t2nr,fld3;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t2 ALL fld1 NULL NULL NULL 1199 where used; Using temporary; Using filesort
-1 SIMPLE t3 eq_ref PRIMARY PRIMARY 4 t2.fld1 1 where used; Using index
+1 SIMPLE t2 ALL fld1 NULL NULL NULL 1199 Using where; Using temporary; Using filesort
+1 SIMPLE t3 eq_ref PRIMARY PRIMARY 4 t2.fld1 1 Using where; Using index
explain select * from t3 as t1,t3 where t1.period=t3.period order by t3.period;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL period NULL NULL NULL 41810 Using temporary; Using filesort
@@ -2575,11 +2575,11 @@ companynr companyname
explain select t2.companynr,companyname from t2 left join t4 using (companynr) where t4.companynr is null;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 ALL NULL NULL NULL NULL 1199
-1 SIMPLE t4 eq_ref PRIMARY PRIMARY 1 test.t2.companynr 1 where used; Not exists
+1 SIMPLE t4 eq_ref PRIMARY PRIMARY 1 test.t2.companynr 1 Using where; Not exists
explain select t2.companynr,companyname from t4 left join t2 using (companynr) where t2.companynr is null;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t4 ALL NULL NULL NULL NULL 12
-1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 where used; Not exists
+1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where; Not exists
select distinct t2.companynr,t4.companynr from t2,t4 where t2.companynr=t4.companynr+1;
companynr companynr
37 36
@@ -2587,7 +2587,7 @@ companynr companynr
explain select distinct t2.companynr,t4.companynr from t2,t4 where t2.companynr=t4.companynr+1;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using temporary
-1 SIMPLE t4 index NULL PRIMARY 1 NULL 12 where used; Using index
+1 SIMPLE t4 index NULL PRIMARY 1 NULL 12 Using where; Using index
select t2.fld1,t2.companynr,fld3,period from t3,t2 where t2.fld1 = 38208 and t2.fld1=t3.t2nr and period = 1008 or t2.fld1 = 38008 and t2.fld1 =t3.t2nr and period = 1008;
fld1 companynr fld3 period
038008 37 reporters 1008
diff --git a/mysql-test/r/temp_table.result b/mysql-test/r/temp_table.result
index 84a00bfea34..45f879e182b 100644
--- a/mysql-test/r/temp_table.result
+++ b/mysql-test/r/temp_table.result
@@ -72,3 +72,25 @@ id val elt(two.val,'one','two')
2 1 one
4 2 two
drop table t1,t2;
+drop table if exists t1;
+CREATE TABLE t1 (
+d datetime default NULL
+) TYPE=MyISAM;
+INSERT INTO t1 VALUES ('2002-10-24 14:50:32'),('2002-10-24 14:50:33'),('2002-10-24 14:50:34'),('2002-10-24 14:50:34'),('2002-10-24 14:50:34'),('2002-10-24 14:50:35'),('2002-10-24 14:50:35'),('2002-10-24 14:50:35'),('2002-10-24 14:50:35'),('2002-10-24 14:50:36'),('2002-10-24 14:50:36'),('2002-10-24 14:50:36'),('2002-10-24 14:50:36'),('2002-10-24 14:50:37'),('2002-10-24 14:50:37'),('2002-10-24 14:50:37'),('2002-10-24 14:50:37'),('2002-10-24 14:50:38'),('2002-10-24 14:50:38'),('2002-10-24 14:50:38'),('2002-10-24 14:50:39'),('2002-10-24 14:50:39'),('2002-10-24 14:50:39'),('2002-10-24 14:50:39'),('2002-10-24 14:50:40'),('2002-10-24 14:50:40'),('2002-10-24 14:50:40');
+flush status;
+select * from t1 group by d;
+d
+2002-10-24 14:50:32
+2002-10-24 14:50:33
+2002-10-24 14:50:34
+2002-10-24 14:50:35
+2002-10-24 14:50:36
+2002-10-24 14:50:37
+2002-10-24 14:50:38
+2002-10-24 14:50:39
+2002-10-24 14:50:40
+show status like "created_tmp%tables";
+Variable_name Value
+Created_tmp_disk_tables 0
+Created_tmp_tables 1
+drop table t1;
diff --git a/mysql-test/r/type_datetime.result b/mysql-test/r/type_datetime.result
index 22cfd2ceefa..1e58b8da42e 100644
--- a/mysql-test/r/type_datetime.result
+++ b/mysql-test/r/type_datetime.result
@@ -76,5 +76,5 @@ date numfacture expedition
0000-00-00 00:00:00 1212 0001-00-00 00:00:00
EXPLAIN SELECT * FROM t1 WHERE expedition='0001-00-00 00:00:00';
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ref expedition expedition 8 const 1 where used
+1 SIMPLE t1 ref expedition expedition 8 const 1 Using where
drop table t1;
diff --git a/mysql-test/r/type_decimal.result b/mysql-test/r/type_decimal.result
index 6550e981f5e..0e60eefc9c7 100644
--- a/mysql-test/r/type_decimal.result
+++ b/mysql-test/r/type_decimal.result
@@ -346,3 +346,14 @@ a
1234567890
9999999999
drop table t1;
+create table t1(a decimal(10,0));
+insert into t1 values ("1e4294967295");
+select * from t1;
+a
+99999999999
+delete from t1;
+insert into t1 values("1e4294967297");
+select * from t1;
+a
+99999999999
+drop table t1;
diff --git a/mysql-test/r/user_var.result b/mysql-test/r/user_var.result
index 7421c040766..1b0b359c533 100644
--- a/mysql-test/r/user_var.result
+++ b/mysql-test/r/user_var.result
@@ -19,14 +19,14 @@ i @vv1:=if(sv1.i,1,0) @vv2:=if(sv2.i,1,0) @vv3:=if(sv3.i,1,0) @vv1+@vv2+@vv3
2 1 0 0 1
explain select * from t1 where i=@vv1;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ref i i 4 const 1 where used
+1 SIMPLE t1 ref i i 4 const 1 Using where
explain select * from t1 where @vv1:=@vv1+1 and i=@vv1;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ALL NULL NULL NULL NULL 3 where used
+1 SIMPLE t1 ALL NULL NULL NULL NULL 3 Using where
explain select @vv1:=i from t1 where i=@vv1;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 index NULL i 4 NULL 3 where used; Using index
+1 SIMPLE t1 index NULL i 4 NULL 3 Using where; Using index
explain select * from t1 where i=@vv1;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ref i i 4 const 1 where used
+1 SIMPLE t1 ref i i 4 const 1 Using where
drop table t1,t2;
diff --git a/mysql-test/r/variables.result b/mysql-test/r/variables.result
index 03454f101d4..fbbf7fcb8f4 100644
--- a/mysql-test/r/variables.result
+++ b/mysql-test/r/variables.result
@@ -105,7 +105,6 @@ show global variables like 'table_type';
Variable_name Value
table_type INNODB
set GLOBAL query_cache_size=100000;
-set GLOBAL safe_show_database=0;
set myisam_max_sort_file_size=10000, GLOBAL myisam_max_sort_file_size=20000;
show variables like 'myisam_max_sort_file_size';
Variable_name Value
@@ -168,6 +167,10 @@ convert_character_set cp1251_koi8
select @@timestamp>0;
@@timestamp>0
1
+set @@rand_seed1=10000000,@@rand_seed2=1000000;
+select ROUND(RAND(),5);
+ROUND(RAND(),5)
+0.02887
set big_tables=OFFF;
Variable 'big_tables' can't be set to the value of 'OFFF'
set big_tables="OFFF";
@@ -273,7 +276,6 @@ set global query_cache_type=demand;
set read_buffer_size=100;
set read_rnd_buffer_size=100;
set global rpl_recovery_rank=100;
-set global safe_show_database=1;
set global server_id=100;
set global slave_net_timeout=100;
set global slow_launch_time=100;
diff --git a/mysql-test/t/bdb.test b/mysql-test/t/bdb.test
index 0df93b5f220..608d4bf5042 100644
--- a/mysql-test/t/bdb.test
+++ b/mysql-test/t/bdb.test
@@ -39,7 +39,7 @@ select * from t1;
update ignore t1 set id=id+1; # This will change all rows
select * from t1;
update ignore t1 set id=1023 where id=1010;
-select * from t1 where parent_id=102;
+select * from t1 where parent_id=102 order by parent_id,id;
explain select level from t1 where level=1;
explain select level,id from t1 where level=1;
explain select level,id,parent_id from t1 where level=1;
diff --git a/mysql-test/t/bdb_cache-master.opt b/mysql-test/t/bdb_cache-master.opt
new file mode 100644
index 00000000000..5f0ebff98f6
--- /dev/null
+++ b/mysql-test/t/bdb_cache-master.opt
@@ -0,0 +1 @@
+--set-variable=query_cache_size=1M
diff --git a/mysql-test/t/bdb_cache.test b/mysql-test/t/bdb_cache.test
new file mode 100644
index 00000000000..aa5572886c5
--- /dev/null
+++ b/mysql-test/t/bdb_cache.test
@@ -0,0 +1,50 @@
+-- source include/have_bdb.inc
+-- source include/have_query_cache.inc
+
+#
+# Without auto_commit.
+#
+drop table if exists t1, t2, t3;
+flush status;
+set autocommit=0;
+create table t1 (a int not null) type=bdb;
+insert into t1 values (1),(2),(3);
+select * from t1;
+show status like "Qcache_queries_in_cache";
+drop table t1;
+commit;
+set autocommit=1;
+begin;
+create table t1 (a int not null) type=bdb;
+insert into t1 values (1),(2),(3);
+select * from t1;
+show status like "Qcache_queries_in_cache";
+drop table t1;
+commit;
+create table t1 (a int not null) type=bdb;
+create table t2 (a int not null) type=bdb;
+create table t3 (a int not null) type=bdb;
+insert into t1 values (1),(2);
+insert into t2 values (1),(2);
+insert into t3 values (1),(2);
+select * from t1;
+select * from t2;
+select * from t3;
+show status like "Qcache_queries_in_cache";
+show status like "Qcache_hits";
+begin;
+select * from t1;
+select * from t2;
+select * from t3;
+show status like "Qcache_queries_in_cache";
+show status like "Qcache_hits";
+insert into t1 values (3);
+insert into t2 values (3);
+insert into t1 values (4);
+select * from t1;
+select * from t2;
+select * from t3;
+show status like "Qcache_queries_in_cache";
+show status like "Qcache_hits";
+commit;
+show status like "Qcache_queries_in_cache"; \ No newline at end of file
diff --git a/mysql-test/t/bool.test b/mysql-test/t/bool.test
new file mode 100644
index 00000000000..10f97fefb73
--- /dev/null
+++ b/mysql-test/t/bool.test
@@ -0,0 +1,51 @@
+#
+# Test of boolean operations with NULL
+#
+
+DROP TABLE IF EXISTS t1;
+
+SELECT IF(NULL AND 1, 1, 2), IF(1 AND NULL, 1, 2);
+SELECT NULL AND 1, 1 AND NULL, 0 AND NULL, NULL and 0;
+
+create table t1 (a int);
+insert into t1 values (0),(1),(NULL);
+SELECT * FROM t1 WHERE IF(a AND 1, 0, 1);
+SELECT * FROM t1 WHERE IF(1 AND a, 0, 1);
+SELECT * FROM t1 where NOT(a AND 1);
+SELECT * FROM t1 where NOT(1 AND a);
+SELECT * FROM t1 where (a AND 1)=0;
+SELECT * FROM t1 where (1 AND a)=0;
+SELECT * FROM t1 where (1 AND a)=1;
+SELECT * FROM t1 where (1 AND a) IS NULL;
+
+# Verify that NULL optimisation works in AND clause:
+SET @a=0, @b=0;
+SELECT * FROM t1 WHERE NULL AND (@a:=@a+1);
+SELECT * FROM t1 WHERE NOT(a>=0 AND NULL AND (@b:=@b+1));
+SELECT * FROM t1 WHERE a=2 OR (NULL AND (@a:=@a+1));
+SELECT * FROM t1 WHERE NOT(a=2 OR (NULL AND (@b:=@b+1)));
+SELECT @a, @b;
+DROP TABLE t1;
+
+
+# Test boolean operators in select part
+# NULLs are represented as N for readability
+# Read nA as !A, AB as A && B, AoB as A || B
+# Result table makes ANSI happy
+
+drop table if exists t;
+create table t(a int, b int);
+insert into t values(null, null), (0, null), (1, null), (null, 0), (null, 1), (0, 0), (0, 1), (1, 0), (1, 1);
+
+# Below test is valid untill we have True/False implemented as 1/0
+# To comply to all rules it must show that: n(AB) = nAonB, n(AoB) = nAnB
+
+select ifnull(A, 'N') as A, ifnull(B, 'N') as B, ifnull(not A, 'N') as nA, ifnull(not B, 'N') as nB, ifnull(A and B, 'N') as AB, ifnull(not (A and B), 'N') as `n(AB)`, ifnull((not A or not B), 'N') as nAonB, ifnull(A or B, 'N') as AoB, ifnull(not(A or B), 'N') as `n(AoB)`, ifnull(not A and not B, 'N') as nAnB from t;
+
+# This should work with any internal representation of True/False
+# Result must be same as above
+
+select ifnull(A=1, 'N') as A, ifnull(B=1, 'N') as B, ifnull(not (A=1), 'N') as nA, ifnull(not (B=1), 'N') as nB, ifnull((A=1) and (B=1), 'N') as AB, ifnull(not ((A=1) and (B=1)), 'N') as `n(AB)`, ifnull((not (A=1) or not (B=1)), 'N') as nAonB, ifnull((A=1) or (B=1), 'N') as AoB, ifnull(not((A=1) or (B=1)), 'N') as `n(AoB)`, ifnull(not (A=1) and not (B=1), 'N') as nAnB from t;
+
+
+drop table t;
diff --git a/mysql-test/t/fulltext.test b/mysql-test/t/fulltext.test
index 6483045f4ed..5a64f2614aa 100644
--- a/mysql-test/t/fulltext.test
+++ b/mysql-test/t/fulltext.test
@@ -40,6 +40,7 @@ select * from t1 where MATCH a,b AGAINST ('"Now sUPPort"' IN BOOLEAN MODE);
select * from t1 where MATCH a,b AGAINST ('"text search" "now support"' IN BOOLEAN MODE);
select * from t1 where MATCH a,b AGAINST ('"text search" -"now support"' IN BOOLEAN MODE);
select * from t1 where MATCH a,b AGAINST ('"text search" +"now support"' IN BOOLEAN MODE);
+select * from t1 where MATCH a,b AGAINST ('"text i"' IN BOOLEAN MODE);
# boolean w/o index:
diff --git a/mysql-test/t/func_time.test b/mysql-test/t/func_time.test
index a052f5f2d92..2ff57959965 100644
--- a/mysql-test/t/func_time.test
+++ b/mysql-test/t/func_time.test
@@ -1,7 +1,7 @@
#
# time functions
#
-drop table if exists t1,t2;
+drop table if exists t1,t2,t3;
select from_days(to_days("960101")),to_days(960201)-to_days("19960101"),to_days(date_add(curdate(), interval 1 day))-to_days(curdate()),weekday("1997-11-29");
select period_add("9602",-12),period_diff(199505,"9404") ;
@@ -34,6 +34,9 @@ select yearweek("2000-01-01",0) as '2000', yearweek("2001-01-01",0) as '2001', y
select yearweek("2000-01-06",0) as '2000', yearweek("2001-01-06",0) as '2001', yearweek("2002-01-06",0) as '2002',yearweek("2003-01-06",0) as '2003', yearweek("2004-01-06",0) as '2004', yearweek("2005-01-06",0) as '2005', yearweek("2006-01-06",0) as '2006';
select yearweek("2000-01-01",1) as '2000', yearweek("2001-01-01",1) as '2001', yearweek("2002-01-01",1) as '2002',yearweek("2003-01-01",1) as '2003', yearweek("2004-01-01",1) as '2004', yearweek("2005-01-01",1) as '2005', yearweek("2006-01-01",1) as '2006';
select yearweek("2000-01-06",1) as '2000', yearweek("2001-01-06",1) as '2001', yearweek("2002-01-06",1) as '2002',yearweek("2003-01-06",1) as '2003', yearweek("2004-01-06",1) as '2004', yearweek("2005-01-06",1) as '2005', yearweek("2006-01-06",1) as '2006';
+select week(19981231,2), week(19981231,3), week(20000101,2), week(20000101,3);
+select week(20001231,2),week(20001231,3);
+
select date_format('1998-12-31','%x-%v'),date_format('1999-01-01','%x-%v');
select date_format('1999-12-31','%x-%v'),date_format('2000-01-01','%x-%v');
@@ -160,3 +163,20 @@ select yearweek("0000-00-00"),yearweek(d),yearweek(dt),yearweek(t),yearweek(c) f
select to_days("0000-00-00"),to_days(d),to_days(dt),to_days(t),to_days(c) from t1;
select extract(MONTH FROM "0000-00-00"),extract(MONTH FROM d),extract(MONTH FROM dt),extract(MONTH FROM t),extract(MONTH FROM c) from t1;
drop table t1;
+
+#
+# Test problem with TIMESTAMP and BETWEEN
+#
+
+CREATE TABLE t1 ( start datetime default NULL);
+INSERT INTO t1 VALUES ('2002-10-21 00:00:00'),('2002-10-28 00:00:00'),('2002-11-04 00:00:00');
+CREATE TABLE t2 ( ctime1 timestamp(14) NOT NULL, ctime2 timestamp(14) NOT NULL);
+INSERT INTO t2 VALUES (20021029165106,20021105164731);
+CREATE TABLE t3 (ctime1 char(19) NOT NULL, ctime2 char(19) NOT NULL);
+INSERT INTO t3 VALUES ("2002-10-29 16:51:06","2002-11-05 16:47:31");
+
+# The following statement should be fixed to return a row in 4.1
+select * from t1, t2 where t1.start between t2.ctime1 and t2.ctime2;
+select * from t1, t2 where t1.start >= t2.ctime1 and t1.start <= t2.ctime2;
+select * from t1, t3 where t1.start between t3.ctime1 and t3.ctime2;
+drop table t1,t2,t3;
diff --git a/mysql-test/t/group_by.test b/mysql-test/t/group_by.test
index 072a1830f57..2f2f50c4085 100644
--- a/mysql-test/t/group_by.test
+++ b/mysql-test/t/group_by.test
@@ -2,7 +2,7 @@
# Test of group (Failed for Lars Hoss <lh@pbm.de>)
#
-drop table if exists t1,t2;
+drop table if exists t1,t2,t3;
CREATE TABLE t1 (
spID int(10) unsigned,
userID int(10) unsigned,
@@ -312,3 +312,42 @@ insert into t1 values (1,244,NULL),(2,243,NULL),(134,223,NULL),(185,186,NULL);
select S.ID as xID, S.ID1 as xID1 from t1 as S left join t1 as yS on S.ID1 between yS.ID1 and yS.ID2;
select S.ID as xID, S.ID1 as xID1, repeat('*',count(distinct yS.ID)) as Level from t1 as S left join t1 as yS on S.ID1 between yS.ID1 and yS.ID2 group by xID order by xID1;
drop table t1;
+
+#
+# Problem with MAX and LEFT JOIN
+#
+
+CREATE TABLE t1 (
+ pid int(11) unsigned NOT NULL default '0',
+ c1id int(11) unsigned default NULL,
+ c2id int(11) unsigned default NULL,
+ value int(11) unsigned NOT NULL default '0',
+ UNIQUE KEY pid2 (pid,c1id,c2id),
+ UNIQUE KEY pid (pid,value)
+) TYPE=MyISAM;
+
+INSERT INTO t1 VALUES (1, 1, NULL, 1),(1, 2, NULL, 2),(1, NULL, 3, 3),(1, 4, NULL, 4),(1, 5, NULL, 5);
+
+CREATE TABLE t2 (
+ id int(11) unsigned NOT NULL default '0',
+ active enum('Yes','No') NOT NULL default 'Yes',
+ PRIMARY KEY (id)
+) TYPE=MyISAM;
+
+INSERT INTO t2 VALUES (1, 'Yes'),(2, 'No'),(4, 'Yes'),(5, 'No');
+
+CREATE TABLE t3 (
+ id int(11) unsigned NOT NULL default '0',
+ active enum('Yes','No') NOT NULL default 'Yes',
+ PRIMARY KEY (id)
+);
+INSERT INTO t3 VALUES (3, 'Yes');
+
+select * from t1 AS m LEFT JOIN t2 AS c1 ON m.c1id =
+c1.id AND c1.active = 'Yes' LEFT JOIN t3 AS c2 ON m.c2id = c2.id AND
+c2.active = 'Yes' WHERE m.pid=1 AND (c1.id IS NOT NULL OR c2.id IS NOT NULL);
+select max(value) from t1 AS m LEFT JOIN t2 AS c1 ON
+m.c1id = c1.id AND c1.active = 'Yes' LEFT JOIN t3 AS c2 ON m.c2id =
+c2.id AND c2.active = 'Yes' WHERE m.pid=1 AND (c1.id IS NOT NULL OR c2.id IS
+NOT NULL);
+drop table t1,t2,t3;
diff --git a/mysql-test/t/merge.test b/mysql-test/t/merge.test
index 86e787db0a3..2199f50fb16 100644
--- a/mysql-test/t/merge.test
+++ b/mysql-test/t/merge.test
@@ -185,3 +185,55 @@ CREATE TABLE t ( a int(11) NOT NULL default '0', b int(11) NOT NULL default '0
select max(b) from t where a = 2;
select max(b) from t1 where a = 2;
drop table if exists t,t1,t2;
+
+#
+# temporary merge tables
+#
+drop table if exists t1, t2, t3, t4, t5, t6;
+create table t1 (a int not null);
+create table t2 (a int not null);
+insert into t1 values (1);
+insert into t2 values (2);
+create temporary table t3 (a int not null) TYPE=MERGE UNION=(t1,t2);
+select * from t3;
+create temporary table t4 (a int not null);
+create temporary table t5 (a int not null);
+insert into t4 values (1);
+insert into t5 values (2);
+create temporary table t6 (a int not null) TYPE=MERGE UNION=(t4,t5);
+select * from t6;
+drop table if exists t1, t2, t3, t4, t5, t6;
+
+#
+# testing merge::records_in_range and optimizer
+#
+
+DROP TABLE IF EXISTS t1, t2;
+CREATE TABLE t1 (
+ fileset_id tinyint(3) unsigned NOT NULL default '0',
+ file_code varchar(32) NOT NULL default '',
+ fileset_root_id tinyint(3) unsigned NOT NULL default '0',
+ PRIMARY KEY (fileset_id,file_code),
+ KEY files (fileset_id,fileset_root_id)
+) TYPE=MyISAM;
+INSERT INTO t1 VALUES (2, '0000000111', 1), (2, '0000000112', 1), (2, '0000000113', 1),
+(2, '0000000114', 1), (2, '0000000115', 1), (2, '0000000116', 1), (2, '0000000117', 1),
+(2, '0000000118', 1), (2, '0000000119', 1), (2, '0000000120', 1);
+CREATE TABLE t2 (
+ fileset_id tinyint(3) unsigned NOT NULL default '0',
+ file_code varchar(32) NOT NULL default '',
+ fileset_root_id tinyint(3) unsigned NOT NULL default '0',
+ PRIMARY KEY (fileset_id,file_code),
+ KEY files (fileset_id,fileset_root_id)
+) TYPE=MRG_MyISAM UNION=(t1);
+
+EXPLAIN SELECT * FROM t2 IGNORE INDEX (files) WHERE fileset_id = 2
+AND file_code BETWEEN '0000000115' AND '0000000120' LIMIT 1;
+EXPLAIN SELECT * FROM t2 WHERE fileset_id = 2
+AND file_code BETWEEN '0000000115' AND '0000000120' LIMIT 1;
+EXPLAIN SELECT * FROM t1 WHERE fileset_id = 2
+AND file_code BETWEEN '0000000115' AND '0000000120' LIMIT 1;
+EXPLAIN SELECT * FROM t2 WHERE fileset_id = 2
+AND file_code = '0000000115' LIMIT 1;
+DROP TABLE IF EXISTS t1, t2;
+
diff --git a/mysql-test/t/multi_update.test b/mysql-test/t/multi_update.test
index 7d855dd54ea..b3a51ff65bc 100644
--- a/mysql-test/t/multi_update.test
+++ b/mysql-test/t/multi_update.test
@@ -147,4 +147,30 @@ insert into t2 values (1),(2),(4),(8),(16),(32);
select * from t2 left outer join t1 using (n);
delete t1,t2 from t2 left outer join t1 using (n);
select * from t2 left outer join t1 using (n);
-drop table if exists t1,t2 ;
+drop table t1,t2 ;
+
+#
+# Test with locking
+#
+
+create table t1 (n int(10) not null primary key, d int(10));
+create table t2 (n int(10) not null primary key, d int(10));
+insert into t1 values(1,1);
+insert into t2 values(1,10),(2,20);
+LOCK TABLES t1 write, t2 read;
+--error 1099
+DELETE t1.*, t2.* FROM t1,t2 where t1.n=t2.n;
+--error 1099
+UPDATE t1,t2 SET t1.d=t2.d,t2.d=30 WHERE t1.n=t2.n;
+# The following should be fixed to not give an error
+--error 1099
+UPDATE t1,t2 SET t1.d=t2.d WHERE t1.n=t2.n;
+unlock tables;
+LOCK TABLES t1 write, t2 write;
+UPDATE t1,t2 SET t1.d=t2.d WHERE t1.n=t2.n;
+select * from t1;
+DELETE t1.*, t2.* FROM t1,t2 where t1.n=t2.n;
+select * from t1;
+select * from t2;
+unlock tables;
+drop table t1,t2;
diff --git a/mysql-test/t/myisam.test b/mysql-test/t/myisam.test
index c69b87f325a..9c261ebf5bb 100644
--- a/mysql-test/t/myisam.test
+++ b/mysql-test/t/myisam.test
@@ -68,6 +68,227 @@ explain select a,b,c from t1;
drop table t1;
#
+# Test of OPTIMIZE of locked and modified tables
+#
+CREATE TABLE t1 (a INT);
+INSERT INTO t1 VALUES (1), (2), (3);
+LOCK TABLES t1 WRITE;
+INSERT INTO t1 VALUES (1), (2), (3);
+OPTIMIZE TABLE t1;
+DROP TABLE t1;
+
+#
+# Test of optimize, when only mi_sort_index (but not mi_repair*) is done
+# in ha_myisam::repair, and index size is changed (decreased).
+#
+
+drop table if exists t1;
+create table t1 ( t1 char(255), key(t1(250)));
+insert t1 values ('137513751375137513751375137513751375137569516951695169516951695169516951695169');
+insert t1 values ('178417841784178417841784178417841784178403420342034203420342034203420342034203');
+insert t1 values ('213872387238723872387238723872387238723867376737673767376737673767376737673767');
+insert t1 values ('242624262426242624262426242624262426242607890789078907890789078907890789078907');
+insert t1 values ('256025602560256025602560256025602560256011701170117011701170117011701170117011');
+insert t1 values ('276027602760276027602760276027602760276001610161016101610161016101610161016101');
+insert t1 values ('281528152815281528152815281528152815281564956495649564956495649564956495649564');
+insert t1 values ('292129212921292129212921292129212921292102100210021002100210021002100210021002');
+insert t1 values ('380638063806380638063806380638063806380634483448344834483448344834483448344834');
+insert t1 values ('411641164116411641164116411641164116411616301630163016301630163016301630163016');
+insert t1 values ('420842084208420842084208420842084208420899889988998899889988998899889988998899');
+insert t1 values ('438443844384438443844384438443844384438482448244824482448244824482448244824482');
+insert t1 values ('443244324432443244324432443244324432443239613961396139613961396139613961396139');
+insert t1 values ('485448544854485448544854485448544854485477847784778477847784778477847784778477');
+insert t1 values ('494549454945494549454945494549454945494555275527552755275527552755275527552755');
+insert t1 values ('538647864786478647864786478647864786478688918891889188918891889188918891889188');
+insert t1 values ('565556555655565556555655565556555655565554845484548454845484548454845484548454');
+insert t1 values ('607860786078607860786078607860786078607856665666566656665666566656665666566656');
+insert t1 values ('640164016401640164016401640164016401640141274127412741274127412741274127412741');
+insert t1 values ('719471947194719471947194719471947194719478717871787178717871787178717871787178');
+insert t1 values ('742574257425742574257425742574257425742549604960496049604960496049604960496049');
+insert t1 values ('887088708870887088708870887088708870887035963596359635963596359635963596359635');
+insert t1 values ('917791779177917791779177917791779177917773857385738573857385738573857385738573');
+insert t1 values ('933293329332933293329332933293329332933278987898789878987898789878987898789878');
+insert t1 values ('963896389638963896389638963896389638963877807780778077807780778077807780778077');
+delete from t1 where t1>'2';
+insert t1 values ('70'), ('84'), ('60'), ('20'), ('76'), ('89'), ('49'), ('50'),
+('88'), ('61'), ('42'), ('98'), ('39'), ('30'), ('25'), ('66'), ('61'), ('48'),
+('80'), ('84'), ('98'), ('19'), ('91'), ('42'), ('47');
+optimize table t1;
+check table t1;
+drop table t1;
+
+#
+# test of myisam with huge number of packed fields
+#
+
+drop table if exists t1;
+create table t1 (i1 int, i2 int, i3 int, i4 int, i5 int, i6 int, i7 int, i8
+int, i9 int, i10 int, i11 int, i12 int, i13 int, i14 int, i15 int, i16 int, i17
+int, i18 int, i19 int, i20 int, i21 int, i22 int, i23 int, i24 int, i25 int,
+i26 int, i27 int, i28 int, i29 int, i30 int, i31 int, i32 int, i33 int, i34
+int, i35 int, i36 int, i37 int, i38 int, i39 int, i40 int, i41 int, i42 int,
+i43 int, i44 int, i45 int, i46 int, i47 int, i48 int, i49 int, i50 int, i51
+int, i52 int, i53 int, i54 int, i55 int, i56 int, i57 int, i58 int, i59 int,
+i60 int, i61 int, i62 int, i63 int, i64 int, i65 int, i66 int, i67 int, i68
+int, i69 int, i70 int, i71 int, i72 int, i73 int, i74 int, i75 int, i76 int,
+i77 int, i78 int, i79 int, i80 int, i81 int, i82 int, i83 int, i84 int, i85
+int, i86 int, i87 int, i88 int, i89 int, i90 int, i91 int, i92 int, i93 int,
+i94 int, i95 int, i96 int, i97 int, i98 int, i99 int, i100 int, i101 int, i102
+int, i103 int, i104 int, i105 int, i106 int, i107 int, i108 int, i109 int, i110
+int, i111 int, i112 int, i113 int, i114 int, i115 int, i116 int, i117 int, i118
+int, i119 int, i120 int, i121 int, i122 int, i123 int, i124 int, i125 int, i126
+int, i127 int, i128 int, i129 int, i130 int, i131 int, i132 int, i133 int, i134
+int, i135 int, i136 int, i137 int, i138 int, i139 int, i140 int, i141 int, i142
+int, i143 int, i144 int, i145 int, i146 int, i147 int, i148 int, i149 int, i150
+int, i151 int, i152 int, i153 int, i154 int, i155 int, i156 int, i157 int, i158
+int, i159 int, i160 int, i161 int, i162 int, i163 int, i164 int, i165 int, i166
+int, i167 int, i168 int, i169 int, i170 int, i171 int, i172 int, i173 int, i174
+int, i175 int, i176 int, i177 int, i178 int, i179 int, i180 int, i181 int, i182
+int, i183 int, i184 int, i185 int, i186 int, i187 int, i188 int, i189 int, i190
+int, i191 int, i192 int, i193 int, i194 int, i195 int, i196 int, i197 int, i198
+int, i199 int, i200 int, i201 int, i202 int, i203 int, i204 int, i205 int, i206
+int, i207 int, i208 int, i209 int, i210 int, i211 int, i212 int, i213 int, i214
+int, i215 int, i216 int, i217 int, i218 int, i219 int, i220 int, i221 int, i222
+int, i223 int, i224 int, i225 int, i226 int, i227 int, i228 int, i229 int, i230
+int, i231 int, i232 int, i233 int, i234 int, i235 int, i236 int, i237 int, i238
+int, i239 int, i240 int, i241 int, i242 int, i243 int, i244 int, i245 int, i246
+int, i247 int, i248 int, i249 int, i250 int, i251 int, i252 int, i253 int, i254
+int, i255 int, i256 int, i257 int, i258 int, i259 int, i260 int, i261 int, i262
+int, i263 int, i264 int, i265 int, i266 int, i267 int, i268 int, i269 int, i270
+int, i271 int, i272 int, i273 int, i274 int, i275 int, i276 int, i277 int, i278
+int, i279 int, i280 int, i281 int, i282 int, i283 int, i284 int, i285 int, i286
+int, i287 int, i288 int, i289 int, i290 int, i291 int, i292 int, i293 int, i294
+int, i295 int, i296 int, i297 int, i298 int, i299 int, i300 int, i301 int, i302
+int, i303 int, i304 int, i305 int, i306 int, i307 int, i308 int, i309 int, i310
+int, i311 int, i312 int, i313 int, i314 int, i315 int, i316 int, i317 int, i318
+int, i319 int, i320 int, i321 int, i322 int, i323 int, i324 int, i325 int, i326
+int, i327 int, i328 int, i329 int, i330 int, i331 int, i332 int, i333 int, i334
+int, i335 int, i336 int, i337 int, i338 int, i339 int, i340 int, i341 int, i342
+int, i343 int, i344 int, i345 int, i346 int, i347 int, i348 int, i349 int, i350
+int, i351 int, i352 int, i353 int, i354 int, i355 int, i356 int, i357 int, i358
+int, i359 int, i360 int, i361 int, i362 int, i363 int, i364 int, i365 int, i366
+int, i367 int, i368 int, i369 int, i370 int, i371 int, i372 int, i373 int, i374
+int, i375 int, i376 int, i377 int, i378 int, i379 int, i380 int, i381 int, i382
+int, i383 int, i384 int, i385 int, i386 int, i387 int, i388 int, i389 int, i390
+int, i391 int, i392 int, i393 int, i394 int, i395 int, i396 int, i397 int, i398
+int, i399 int, i400 int, i401 int, i402 int, i403 int, i404 int, i405 int, i406
+int, i407 int, i408 int, i409 int, i410 int, i411 int, i412 int, i413 int, i414
+int, i415 int, i416 int, i417 int, i418 int, i419 int, i420 int, i421 int, i422
+int, i423 int, i424 int, i425 int, i426 int, i427 int, i428 int, i429 int, i430
+int, i431 int, i432 int, i433 int, i434 int, i435 int, i436 int, i437 int, i438
+int, i439 int, i440 int, i441 int, i442 int, i443 int, i444 int, i445 int, i446
+int, i447 int, i448 int, i449 int, i450 int, i451 int, i452 int, i453 int, i454
+int, i455 int, i456 int, i457 int, i458 int, i459 int, i460 int, i461 int, i462
+int, i463 int, i464 int, i465 int, i466 int, i467 int, i468 int, i469 int, i470
+int, i471 int, i472 int, i473 int, i474 int, i475 int, i476 int, i477 int, i478
+int, i479 int, i480 int, i481 int, i482 int, i483 int, i484 int, i485 int, i486
+int, i487 int, i488 int, i489 int, i490 int, i491 int, i492 int, i493 int, i494
+int, i495 int, i496 int, i497 int, i498 int, i499 int, i500 int, i501 int, i502
+int, i503 int, i504 int, i505 int, i506 int, i507 int, i508 int, i509 int, i510
+int, i511 int, i512 int, i513 int, i514 int, i515 int, i516 int, i517 int, i518
+int, i519 int, i520 int, i521 int, i522 int, i523 int, i524 int, i525 int, i526
+int, i527 int, i528 int, i529 int, i530 int, i531 int, i532 int, i533 int, i534
+int, i535 int, i536 int, i537 int, i538 int, i539 int, i540 int, i541 int, i542
+int, i543 int, i544 int, i545 int, i546 int, i547 int, i548 int, i549 int, i550
+int, i551 int, i552 int, i553 int, i554 int, i555 int, i556 int, i557 int, i558
+int, i559 int, i560 int, i561 int, i562 int, i563 int, i564 int, i565 int, i566
+int, i567 int, i568 int, i569 int, i570 int, i571 int, i572 int, i573 int, i574
+int, i575 int, i576 int, i577 int, i578 int, i579 int, i580 int, i581 int, i582
+int, i583 int, i584 int, i585 int, i586 int, i587 int, i588 int, i589 int, i590
+int, i591 int, i592 int, i593 int, i594 int, i595 int, i596 int, i597 int, i598
+int, i599 int, i600 int, i601 int, i602 int, i603 int, i604 int, i605 int, i606
+int, i607 int, i608 int, i609 int, i610 int, i611 int, i612 int, i613 int, i614
+int, i615 int, i616 int, i617 int, i618 int, i619 int, i620 int, i621 int, i622
+int, i623 int, i624 int, i625 int, i626 int, i627 int, i628 int, i629 int, i630
+int, i631 int, i632 int, i633 int, i634 int, i635 int, i636 int, i637 int, i638
+int, i639 int, i640 int, i641 int, i642 int, i643 int, i644 int, i645 int, i646
+int, i647 int, i648 int, i649 int, i650 int, i651 int, i652 int, i653 int, i654
+int, i655 int, i656 int, i657 int, i658 int, i659 int, i660 int, i661 int, i662
+int, i663 int, i664 int, i665 int, i666 int, i667 int, i668 int, i669 int, i670
+int, i671 int, i672 int, i673 int, i674 int, i675 int, i676 int, i677 int, i678
+int, i679 int, i680 int, i681 int, i682 int, i683 int, i684 int, i685 int, i686
+int, i687 int, i688 int, i689 int, i690 int, i691 int, i692 int, i693 int, i694
+int, i695 int, i696 int, i697 int, i698 int, i699 int, i700 int, i701 int, i702
+int, i703 int, i704 int, i705 int, i706 int, i707 int, i708 int, i709 int, i710
+int, i711 int, i712 int, i713 int, i714 int, i715 int, i716 int, i717 int, i718
+int, i719 int, i720 int, i721 int, i722 int, i723 int, i724 int, i725 int, i726
+int, i727 int, i728 int, i729 int, i730 int, i731 int, i732 int, i733 int, i734
+int, i735 int, i736 int, i737 int, i738 int, i739 int, i740 int, i741 int, i742
+int, i743 int, i744 int, i745 int, i746 int, i747 int, i748 int, i749 int, i750
+int, i751 int, i752 int, i753 int, i754 int, i755 int, i756 int, i757 int, i758
+int, i759 int, i760 int, i761 int, i762 int, i763 int, i764 int, i765 int, i766
+int, i767 int, i768 int, i769 int, i770 int, i771 int, i772 int, i773 int, i774
+int, i775 int, i776 int, i777 int, i778 int, i779 int, i780 int, i781 int, i782
+int, i783 int, i784 int, i785 int, i786 int, i787 int, i788 int, i789 int, i790
+int, i791 int, i792 int, i793 int, i794 int, i795 int, i796 int, i797 int, i798
+int, i799 int, i800 int, i801 int, i802 int, i803 int, i804 int, i805 int, i806
+int, i807 int, i808 int, i809 int, i810 int, i811 int, i812 int, i813 int, i814
+int, i815 int, i816 int, i817 int, i818 int, i819 int, i820 int, i821 int, i822
+int, i823 int, i824 int, i825 int, i826 int, i827 int, i828 int, i829 int, i830
+int, i831 int, i832 int, i833 int, i834 int, i835 int, i836 int, i837 int, i838
+int, i839 int, i840 int, i841 int, i842 int, i843 int, i844 int, i845 int, i846
+int, i847 int, i848 int, i849 int, i850 int, i851 int, i852 int, i853 int, i854
+int, i855 int, i856 int, i857 int, i858 int, i859 int, i860 int, i861 int, i862
+int, i863 int, i864 int, i865 int, i866 int, i867 int, i868 int, i869 int, i870
+int, i871 int, i872 int, i873 int, i874 int, i875 int, i876 int, i877 int, i878
+int, i879 int, i880 int, i881 int, i882 int, i883 int, i884 int, i885 int, i886
+int, i887 int, i888 int, i889 int, i890 int, i891 int, i892 int, i893 int, i894
+int, i895 int, i896 int, i897 int, i898 int, i899 int, i900 int, i901 int, i902
+int, i903 int, i904 int, i905 int, i906 int, i907 int, i908 int, i909 int, i910
+int, i911 int, i912 int, i913 int, i914 int, i915 int, i916 int, i917 int, i918
+int, i919 int, i920 int, i921 int, i922 int, i923 int, i924 int, i925 int, i926
+int, i927 int, i928 int, i929 int, i930 int, i931 int, i932 int, i933 int, i934
+int, i935 int, i936 int, i937 int, i938 int, i939 int, i940 int, i941 int, i942
+int, i943 int, i944 int, i945 int, i946 int, i947 int, i948 int, i949 int, i950
+int, i951 int, i952 int, i953 int, i954 int, i955 int, i956 int, i957 int, i958
+int, i959 int, i960 int, i961 int, i962 int, i963 int, i964 int, i965 int, i966
+int, i967 int, i968 int, i969 int, i970 int, i971 int, i972 int, i973 int, i974
+int, i975 int, i976 int, i977 int, i978 int, i979 int, i980 int, i981 int, i982
+int, i983 int, i984 int, i985 int, i986 int, i987 int, i988 int, i989 int, i990
+int, i991 int, i992 int, i993 int, i994 int, i995 int, i996 int, i997 int, i998
+int, i999 int, i1000 int) row_format=dynamic;
+insert into t1 values (1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1);
+drop table if exists t1;
+
+#
# Test of REPAIR that once failed
#
CREATE TABLE `t1` (
@@ -95,16 +316,6 @@ CHECK TABLE t1;
drop table t1;
#
-# Test of OPTIMIZE of locked and modified tables
-#
-CREATE TABLE t1 (a INT);
-INSERT INTO t1 VALUES (1), (2), (3);
-LOCK TABLES t1 WRITE;
-INSERT INTO t1 VALUES (1), (2), (3);
-OPTIMIZE TABLE t1;
-DROP TABLE t1;
-
-#
# Test of creating table with too long key
#
@@ -114,3 +325,4 @@ CREATE TABLE t1 (a varchar(255), b varchar(255), c varchar(255));
--error 1071
ALTER TABLE t1 ADD INDEX t1 (a, b, c);
DROP TABLE t1;
+
diff --git a/mysql-test/t/query_cache.test b/mysql-test/t/query_cache.test
index a0d2a34ee76..6c3f3d6ac52 100644
--- a/mysql-test/t/query_cache.test
+++ b/mysql-test/t/query_cache.test
@@ -206,6 +206,7 @@ insert into t2 select * from t1; # 2584
insert into t1 select * from t2; # 4181
show status like "Qcache_hits";
+show status like "Qcache_lowmem_prunes";
disable_result_log;
select a as a1, a as a2 from t1;
select a as a2, a as a3 from t1;
@@ -215,6 +216,7 @@ select a as a1, a as a2 from t1;
enable_result_log;
show status like "Qcache_hits";
show status like "Qcache_queries_in_cache";
+show status like "Qcache_lowmem_prunes";
reset query cache;
#
# Query bigger then query_cache_limit
diff --git a/mysql-test/t/rpl000007-slave.opt b/mysql-test/t/rpl000007-slave.opt
deleted file mode 100644
index 9ff99337d1f..00000000000
--- a/mysql-test/t/rpl000007-slave.opt
+++ /dev/null
@@ -1 +0,0 @@
---replicate-do-table=test.bar
diff --git a/mysql-test/t/rpl000007.test b/mysql-test/t/rpl000007.test
deleted file mode 100644
index 8ff1e1782cc..00000000000
--- a/mysql-test/t/rpl000007.test
+++ /dev/null
@@ -1,24 +0,0 @@
-#this one assumes we are ignoring updates on table foo, but doing
-#the ones on bar
-source include/master-slave.inc;
-connection slave;
-drop table if exists foo;
-create table foo (n int);
-insert into foo values(4);
-connection master;
-drop table if exists foo;
-create table foo (s char(20));
-load data infile '../../std_data/words.dat' into table foo;
-insert into foo values('five');
-drop table if exists bar;
-create table bar (m int);
-insert into bar values(15);
-save_master_pos;
-connection slave;
-sync_with_master;
-select foo.n,bar.m from foo,bar;
-connection master;
-drop table if exists bar,foo;
-save_master_pos;
-connection slave;
-sync_with_master;
diff --git a/mysql-test/t/rpl_replicate_do-slave.opt b/mysql-test/t/rpl_replicate_do-slave.opt
new file mode 100644
index 00000000000..da345474216
--- /dev/null
+++ b/mysql-test/t/rpl_replicate_do-slave.opt
@@ -0,0 +1 @@
+--replicate-do-table=test.t1
diff --git a/mysql-test/t/rpl_replicate_do.test b/mysql-test/t/rpl_replicate_do.test
new file mode 100644
index 00000000000..0800062dc05
--- /dev/null
+++ b/mysql-test/t/rpl_replicate_do.test
@@ -0,0 +1,30 @@
+# This test assumes we are ignoring updates on table t2, but doing
+# updates on t1
+
+source include/master-slave.inc;
+drop table if exists t11;
+connection slave;
+drop table if exists t11;
+create table t2 (n int);
+insert into t2 values(4);
+connection master;
+create table t2 (s char(20));
+load data infile '../../std_data/words.dat' into table t2;
+insert into t2 values('five');
+create table t1 (m int);
+insert into t1 values(15),(16),(17);
+update t1 set m=20 where m=16;
+delete from t1 where m=17;
+create table t11 select * from t1;
+save_master_pos;
+connection slave;
+sync_with_master;
+select * from t1;
+select * from t2;
+--error 1146
+select * from t11;
+connection master;
+drop table if exists t1,t2,t3,t11;
+save_master_pos;
+connection slave;
+sync_with_master;
diff --git a/mysql-test/t/rpl_rotate_logs.test b/mysql-test/t/rpl_rotate_logs.test
index f328e938f61..c552936d93f 100644
--- a/mysql-test/t/rpl_rotate_logs.test
+++ b/mysql-test/t/rpl_rotate_logs.test
@@ -10,10 +10,12 @@
# - Test creating a duplicate key error and recover from it
#
connect (master,localhost,root,,test,0,master.sock);
+drop table if exists t1, t2, t3, t4;
connect (slave,localhost,root,,test,0,slave.sock);
system cat /dev/null > var/slave-data/master.info;
system chmod 000 var/slave-data/master.info;
connection slave;
+drop table if exists t1, t2, t3, t4;
--error 1201
start slave;
system chmod 600 var/slave-data/master.info;
@@ -31,8 +33,6 @@ connection slave;
start slave;
connection master;
-drop table if exists t1, t2, t3, t4;
-
#
# Test FLUSH LOGS
#
diff --git a/mysql-test/t/temp_table.test b/mysql-test/t/temp_table.test
index 3cf18bae9fe..10168cf13c7 100644
--- a/mysql-test/t/temp_table.test
+++ b/mysql-test/t/temp_table.test
@@ -60,3 +60,21 @@ insert into t2 values (1,1),(2,1),(3,1),(4,2);
# do a query using ELT, a join and an ORDER BY.
select one.id, two.val, elt(two.val,'one','two') from t1 one, t2 two where two.id=one.id order by one.id;
drop table t1,t2;
+
+#
+# In MySQL 4.0.4 doing a GROUP BY on a NULL column created a disk based
+# temporary table when a memory based one would be good enough.
+
+drop table if exists t1;
+
+CREATE TABLE t1 (
+ d datetime default NULL
+) TYPE=MyISAM;
+
+
+INSERT INTO t1 VALUES ('2002-10-24 14:50:32'),('2002-10-24 14:50:33'),('2002-10-24 14:50:34'),('2002-10-24 14:50:34'),('2002-10-24 14:50:34'),('2002-10-24 14:50:35'),('2002-10-24 14:50:35'),('2002-10-24 14:50:35'),('2002-10-24 14:50:35'),('2002-10-24 14:50:36'),('2002-10-24 14:50:36'),('2002-10-24 14:50:36'),('2002-10-24 14:50:36'),('2002-10-24 14:50:37'),('2002-10-24 14:50:37'),('2002-10-24 14:50:37'),('2002-10-24 14:50:37'),('2002-10-24 14:50:38'),('2002-10-24 14:50:38'),('2002-10-24 14:50:38'),('2002-10-24 14:50:39'),('2002-10-24 14:50:39'),('2002-10-24 14:50:39'),('2002-10-24 14:50:39'),('2002-10-24 14:50:40'),('2002-10-24 14:50:40'),('2002-10-24 14:50:40');
+
+flush status;
+select * from t1 group by d;
+show status like "created_tmp%tables";
+drop table t1;
diff --git a/mysql-test/t/type_decimal.test b/mysql-test/t/type_decimal.test
index 95420539611..7f73ec34e3a 100644
--- a/mysql-test/t/type_decimal.test
+++ b/mysql-test/t/type_decimal.test
@@ -220,3 +220,13 @@ create table t1 (a decimal unsigned zerofill);
insert into t1 values (-99999999999999),(-1),('+1'),('01'),('+00000000000001'),('+1234567890'),(99999999999999);
select * from t1;
drop table t1;
+
+# Exponent overflow bug
+create table t1(a decimal(10,0));
+insert into t1 values ("1e4294967295");
+select * from t1;
+delete from t1;
+insert into t1 values("1e4294967297");
+select * from t1;
+drop table t1;
+
diff --git a/mysql-test/t/variables.test b/mysql-test/t/variables.test
index 564a6b864e8..552777743f8 100644
--- a/mysql-test/t/variables.test
+++ b/mysql-test/t/variables.test
@@ -66,7 +66,6 @@ set table_type=MYISAM, table_type="HEAP", global table_type="INNODB";
show local variables like 'table_type';
show global variables like 'table_type';
set GLOBAL query_cache_size=100000;
-set GLOBAL safe_show_database=0;
set myisam_max_sort_file_size=10000, GLOBAL myisam_max_sort_file_size=20000;
show variables like 'myisam_max_sort_file_size';
@@ -95,6 +94,10 @@ set global character set default, session character set default;
show variables like "convert_character_set";
select @@timestamp>0;
+set @@rand_seed1=10000000,@@rand_seed2=1000000;
+select ROUND(RAND(),5);
+
+
# The following should give errors
--error 1231
@@ -189,7 +192,6 @@ set global query_cache_type=demand;
set read_buffer_size=100;
set read_rnd_buffer_size=100;
set global rpl_recovery_rank=100;
-set global safe_show_database=1;
set global server_id=100;
set global slave_net_timeout=100;
set global slow_launch_time=100;