summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorunknown <serg@serg.mysql.com>2000-12-30 16:02:38 +0100
committerunknown <serg@serg.mysql.com>2000-12-30 16:02:38 +0100
commiteb7835da44383a214c8738d6a8cf94610a47a4b8 (patch)
treee24cb5e2ce2bc98e6eaeff7d0d0c0007c8683585
parentc0965de3f377e0a5ee215fe7f0dd662da251e412 (diff)
parent53b6c99d04f3d3a4ff2c9b46d431d379bc5786e6 (diff)
downloadmariadb-git-eb7835da44383a214c8738d6a8cf94610a47a4b8.tar.gz
Merge
sql/sql_show.cc: merged
-rw-r--r--.bzrignore4
-rwxr-xr-xBUILD/compile-pentium6
-rwxr-xr-xBUILD/compile-pentium-debug6
-rwxr-xr-xBUILD/compile-pentium-symbols15
-rw-r--r--Docs/internals.texi145
-rw-r--r--Docs/manual.texi319
-rw-r--r--client/my_readline.h1
-rw-r--r--client/mysql.cc7
-rw-r--r--client/mysqladmin.c1
-rw-r--r--client/mysqldump.c13
-rw-r--r--client/mysqlimport.c13
-rw-r--r--client/mysqltest.c994
-rw-r--r--client/readline.cc9
-rw-r--r--configure.in14
-rw-r--r--heap/_check.c16
-rw-r--r--heap/hp_close.c2
-rw-r--r--heap/hp_hash.c93
-rw-r--r--heap/hp_open.c1
-rw-r--r--heap/hp_test1.c4
-rw-r--r--heap/hp_test2.c21
-rw-r--r--include/heap.h2
-rw-r--r--merge/rrnd.c2
-rw-r--r--myisam/myisamlog.c2
-rw-r--r--mysql-test/include/have_bdb.inc2
-rw-r--r--mysql-test/include/have_isam.inc2
-rwxr-xr-xmysql-test/install_test_db.sh13
-rwxr-xr-xmysql-test/mysql-test-run.sh207
-rw-r--r--mysql-test/r/3.23/README0
-rw-r--r--mysql-test/r/alt000001.result5
-rw-r--r--mysql-test/r/alter_table.result27
-rw-r--r--mysql-test/r/analyse.result6
-rw-r--r--mysql-test/r/auto_increment.result57
-rw-r--r--mysql-test/r/bdb.result404
-rw-r--r--mysql-test/r/bigint.result13
-rw-r--r--mysql-test/r/binary.result33
-rw-r--r--mysql-test/r/case.result34
-rw-r--r--mysql-test/r/comments.result15
-rw-r--r--mysql-test/r/compare.result6
-rw-r--r--mysql-test/r/count_distinct.result9
-rw-r--r--mysql-test/r/create.result10
-rw-r--r--mysql-test/r/crypt.result2
-rw-r--r--mysql-test/r/delayed.result5
-rw-r--r--mysql-test/r/delete.result0
-rw-r--r--mysql-test/r/distinct.result155
-rw-r--r--mysql-test/r/empty_table.result4
-rw-r--r--mysql-test/r/equal.result15
-rw-r--r--mysql-test/r/explain.result15
-rw-r--r--mysql-test/r/ft0000001.a.result6
-rw-r--r--mysql-test/r/ft0000001.b.result6
-rw-r--r--mysql-test/r/ft0000001.c.result6
-rw-r--r--mysql-test/r/ft0000001.d.result4
-rw-r--r--mysql-test/r/ft0000001.e.result16
-rw-r--r--mysql-test/r/ft0000002.a.result8
-rw-r--r--mysql-test/r/ft0000002.b.result8
-rw-r--r--mysql-test/r/ft0000002.c.result8
-rw-r--r--mysql-test/r/fulltext.result8
-rw-r--r--mysql-test/r/func_crypt.result2
-rw-r--r--mysql-test/r/func_date_add.result12
-rw-r--r--mysql-test/r/func_equal.result15
-rw-r--r--mysql-test/r/func_group.result86
-rw-r--r--mysql-test/r/func_in.result14
-rw-r--r--mysql-test/r/func_like.result7
-rw-r--r--mysql-test/r/func_math.result22
-rw-r--r--mysql-test/r/func_misc.result8
-rw-r--r--mysql-test/r/func_op.result6
-rw-r--r--mysql-test/r/func_regexp.result15
-rw-r--r--mysql-test/r/func_set.result18
-rw-r--r--mysql-test/r/func_str.result (renamed from mysql-test/r/strfunc.result)37
-rw-r--r--mysql-test/r/func_system.result4
-rw-r--r--mysql-test/r/func_test.result36
-rw-r--r--mysql-test/r/func_time.result186
-rw-r--r--mysql-test/r/group_by.result32
-rw-r--r--mysql-test/r/have_bdb.require2
-rw-r--r--mysql-test/r/have_isam.require2
-rw-r--r--mysql-test/r/have_raid.require2
-rw-r--r--mysql-test/r/heap.result80
-rw-r--r--mysql-test/r/ins000001.result8
-rw-r--r--mysql-test/r/insert.result6
-rw-r--r--mysql-test/r/insert_select.result13
-rw-r--r--mysql-test/r/join.result9
-rw-r--r--mysql-test/r/join_outer.result315
-rw-r--r--mysql-test/r/key.result12
-rw-r--r--mysql-test/r/key_diff.result39
-rw-r--r--mysql-test/r/key_primary.result9
-rw-r--r--mysql-test/r/keywords.result4
-rw-r--r--mysql-test/r/limit.result22
-rw-r--r--mysql-test/r/merge.result109
-rw-r--r--mysql-test/r/mrg000001.dummy.result1
-rw-r--r--mysql-test/r/mrg000001.result5
-rw-r--r--mysql-test/r/mrg000002.result1
-rw-r--r--mysql-test/r/null.result25
-rw-r--r--mysql-test/r/null_key.result94
-rw-r--r--mysql-test/r/odbc.result7
-rw-r--r--mysql-test/r/order_by.result110
-rw-r--r--mysql-test/r/raid.result8
-rw-r--r--mysql-test/r/range.result57
-rw-r--r--mysql-test/r/rename.result14
-rw-r--r--mysql-test/r/rollback.result3
-rw-r--r--mysql-test/r/rpl000001.a.result6
-rw-r--r--mysql-test/r/rpl000001.b.result4
-rw-r--r--mysql-test/r/rpl000002.result8
-rw-r--r--mysql-test/r/rpl000003.result8
-rw-r--r--mysql-test/r/rpl000004.a.result4
-rw-r--r--mysql-test/r/rpl000004.b.result4
-rw-r--r--mysql-test/r/rpl000005.result8
-rw-r--r--mysql-test/r/rpl000006.result4
-rw-r--r--mysql-test/r/rpl000007.result4
-rw-r--r--mysql-test/r/rpl000008.result4
-rw-r--r--mysql-test/r/rpl000009.result4
-rw-r--r--mysql-test/r/rpl000010.result6
-rw-r--r--mysql-test/r/rpl000011.result6
-rw-r--r--mysql-test/r/rpl000012.result14
-rw-r--r--mysql-test/r/rpl000012.status.result4
-rw-r--r--mysql-test/r/rpl000013.result14
-rw-r--r--mysql-test/r/rpl000013.status.result4
-rw-r--r--mysql-test/r/rpl000014.result32
-rw-r--r--mysql-test/r/rpl000015.result28
-rw-r--r--mysql-test/r/rpl000016.result28
-rw-r--r--mysql-test/r/sel000001.result4
-rw-r--r--mysql-test/r/sel000002.result8
-rw-r--r--mysql-test/r/sel000003.result6
-rw-r--r--mysql-test/r/sel000004.result2
-rw-r--r--mysql-test/r/sel000005.result2
-rw-r--r--mysql-test/r/sel000006.result2
-rw-r--r--mysql-test/r/sel000007.result2
-rw-r--r--mysql-test/r/sel000008.result2
-rw-r--r--mysql-test/r/sel000009.result2
-rw-r--r--mysql-test/r/sel000010.result2
-rw-r--r--mysql-test/r/sel000011.result2
-rw-r--r--mysql-test/r/sel000012.result2
-rw-r--r--mysql-test/r/sel000013.result2
-rw-r--r--mysql-test/r/sel000014.result2
-rw-r--r--mysql-test/r/sel000015.result2
-rw-r--r--mysql-test/r/sel000016.result2
-rw-r--r--mysql-test/r/sel000017.result2
-rw-r--r--mysql-test/r/sel000018.result2
-rw-r--r--mysql-test/r/sel000019.result2
-rw-r--r--mysql-test/r/sel000020.result2
-rw-r--r--mysql-test/r/sel000021.result2
-rw-r--r--mysql-test/r/sel000022.result2
-rw-r--r--mysql-test/r/sel000023.result2
-rw-r--r--mysql-test/r/sel000024.result2
-rw-r--r--mysql-test/r/sel000025.result2
-rw-r--r--mysql-test/r/sel000026.result2
-rw-r--r--mysql-test/r/sel000027.result2
-rw-r--r--mysql-test/r/sel000028.result2
-rw-r--r--mysql-test/r/sel000029.result2
-rw-r--r--mysql-test/r/sel000030.result2
-rw-r--r--mysql-test/r/sel000031.result8
-rw-r--r--mysql-test/r/sel000032.result8
-rw-r--r--mysql-test/r/sel000033.result8
-rw-r--r--mysql-test/r/sel000100.result4
-rw-r--r--mysql-test/r/select_safe.result10
-rw-r--r--mysql-test/r/show_check.result36
-rw-r--r--mysql-test/r/shw000001.result4
-rw-r--r--mysql-test/r/slave-running.result4
-rw-r--r--mysql-test/r/slave-stopped.result4
-rw-r--r--mysql-test/r/tablelock.result12
-rw-r--r--mysql-test/r/temp_table.result30
-rw-r--r--mysql-test/r/truncate.result4
-rw-r--r--mysql-test/r/type_blob.result289
-rw-r--r--mysql-test/r/type_date.result20
-rw-r--r--mysql-test/r/type_datetime.result33
-rw-r--r--mysql-test/r/type_enum.result1616
-rw-r--r--mysql-test/r/type_float.result66
-rw-r--r--mysql-test/r/type_ranges.result159
-rw-r--r--mysql-test/r/type_time.result68
-rw-r--r--mysql-test/r/type_timestamp.result2
-rw-r--r--mysql-test/r/type_uint.result3
-rw-r--r--mysql-test/r/type_year.result21
-rw-r--r--mysql-test/r/update.result2
-rw-r--r--mysql-test/r/varbinary.result6
-rw-r--r--mysql-test/r/variables.result12
-rw-r--r--mysql-test/t/alt000001.test6
-rw-r--r--mysql-test/t/alter_table.test48
-rw-r--r--mysql-test/t/analyse.test10
-rw-r--r--mysql-test/t/auto_increment.test66
-rw-r--r--mysql-test/t/bdb.test328
-rw-r--r--mysql-test/t/bigint.test14
-rw-r--r--mysql-test/t/binary.test33
-rw-r--r--mysql-test/t/case.test21
-rw-r--r--mysql-test/t/comments.test17
-rw-r--r--mysql-test/t/compare.test11
-rw-r--r--mysql-test/t/count_distinct.test34
-rw-r--r--mysql-test/t/create.test58
-rw-r--r--mysql-test/t/delayed.test17
-rw-r--r--mysql-test/t/delete.test37
-rw-r--r--mysql-test/t/distinct.test184
-rw-r--r--mysql-test/t/empty_table.test10
-rw-r--r--mysql-test/t/err000001.test21
-rw-r--r--mysql-test/t/explain.test19
-rw-r--r--mysql-test/t/flush_table.test12
-rw-r--r--mysql-test/t/foreign_key.test20
-rw-r--r--mysql-test/t/fulltext.test11
-rw-r--r--mysql-test/t/func_crypt.test (renamed from mysql-test/t/crypt.test)0
-rw-r--r--mysql-test/t/func_date_add.test39
-rw-r--r--mysql-test/t/func_equal.test (renamed from mysql-test/t/equal.test)0
-rw-r--r--mysql-test/t/func_group.test100
-rw-r--r--mysql-test/t/func_in.test19
-rw-r--r--mysql-test/t/func_like.test10
-rw-r--r--mysql-test/t/func_math.test15
-rw-r--r--mysql-test/t/func_misc.test9
-rw-r--r--mysql-test/t/func_op.test7
-rw-r--r--mysql-test/t/func_regexp.test26
-rw-r--r--mysql-test/t/func_set.test17
-rw-r--r--mysql-test/t/func_str.test (renamed from mysql-test/t/strfunc.test)40
-rw-r--r--mysql-test/t/func_system.test6
-rw-r--r--mysql-test/t/func_test.test26
-rw-r--r--mysql-test/t/func_time.test100
-rw-r--r--mysql-test/t/group_by.test210
-rw-r--r--mysql-test/t/heap.test87
-rw-r--r--mysql-test/t/include/master-slave.inc11
-rw-r--r--mysql-test/t/ins000001.test16
-rw-r--r--mysql-test/t/insert.test12
-rw-r--r--mysql-test/t/insert_select.test12
-rw-r--r--mysql-test/t/join.test89
-rw-r--r--mysql-test/t/join_outer.test395
-rw-r--r--mysql-test/t/key.test146
-rw-r--r--mysql-test/t/key_diff.test19
-rw-r--r--mysql-test/t/key_primary.test14
-rw-r--r--mysql-test/t/keywords.test10
-rw-r--r--mysql-test/t/limit.test19
-rw-r--r--mysql-test/t/merge.test79
-rw-r--r--mysql-test/t/mrg000001.test21
-rw-r--r--mysql-test/t/mrg000002.test2
-rw-r--r--mysql-test/t/null.test22
-rw-r--r--mysql-test/t/null_key.test47
-rw-r--r--mysql-test/t/odbc.test17
-rw-r--r--mysql-test/t/order_by.test167
-rw-r--r--mysql-test/t/outfile.test23
-rw-r--r--mysql-test/t/raid.test195
-rw-r--r--mysql-test/t/range.test102
-rw-r--r--mysql-test/t/rename.test26
-rw-r--r--mysql-test/t/replace.test6
-rw-r--r--mysql-test/t/rollback.test14
-rw-r--r--mysql-test/t/sel000004.test14
-rw-r--r--mysql-test/t/sel000005.test14
-rw-r--r--mysql-test/t/sel000006.test14
-rw-r--r--mysql-test/t/sel000007.test14
-rw-r--r--mysql-test/t/sel000008.test14
-rw-r--r--mysql-test/t/sel000009.test14
-rw-r--r--mysql-test/t/sel000010.test14
-rw-r--r--mysql-test/t/sel000011.test14
-rw-r--r--mysql-test/t/sel000012.test13
-rw-r--r--mysql-test/t/sel000013.test13
-rw-r--r--mysql-test/t/sel000014.test14
-rw-r--r--mysql-test/t/sel000015.test14
-rw-r--r--mysql-test/t/sel000016.test14
-rw-r--r--mysql-test/t/sel000017.test14
-rw-r--r--mysql-test/t/sel000018.test14
-rw-r--r--mysql-test/t/sel000019.test14
-rw-r--r--mysql-test/t/sel000020.test14
-rw-r--r--mysql-test/t/sel000021.test14
-rw-r--r--mysql-test/t/sel000022.test14
-rw-r--r--mysql-test/t/sel000023.test14
-rw-r--r--mysql-test/t/sel000024.test14
-rw-r--r--mysql-test/t/sel000025.test14
-rw-r--r--mysql-test/t/sel000026.test14
-rw-r--r--mysql-test/t/sel000027.test14
-rw-r--r--mysql-test/t/sel000028.test14
-rw-r--r--mysql-test/t/sel000029.test14
-rw-r--r--mysql-test/t/sel000030.test14
-rw-r--r--mysql-test/t/select_safe.test32
-rw-r--r--mysql-test/t/show_check.test28
-rw-r--r--mysql-test/t/tablelock.test47
-rw-r--r--mysql-test/t/temp_table.test62
-rw-r--r--mysql-test/t/truncate.test11
-rw-r--r--mysql-test/t/type_blob.test279
-rw-r--r--mysql-test/t/type_date.test64
-rw-r--r--mysql-test/t/type_datetime.test29
-rw-r--r--mysql-test/t/type_enum.test11
-rw-r--r--mysql-test/t/type_float.test48
-rw-r--r--mysql-test/t/type_ranges.test154
-rw-r--r--mysql-test/t/type_time.test17
-rw-r--r--mysql-test/t/type_timestamp.test9
-rw-r--r--mysql-test/t/type_uint.test10
-rw-r--r--mysql-test/t/type_year.test10
-rw-r--r--mysql-test/t/update.test29
-rw-r--r--mysql-test/t/varbinary.test16
-rw-r--r--mysql-test/t/variables.test14
-rw-r--r--mysql-test/t/warnings.test13
-rw-r--r--mysys/hash.c45
-rw-r--r--scripts/mysqld_multi.sh2
-rw-r--r--scripts/safe_mysqld.sh18
-rw-r--r--sql-bench/Results/ATIS-mysql-Linux_2.2.13_SMP_alpha15
-rw-r--r--sql-bench/Results/RUN-mysql-Linux_2.2.13_SMP_alpha153
-rw-r--r--sql-bench/Results/alter-table-mysql-Linux_2.2.13_SMP_alpha8
-rw-r--r--sql-bench/Results/big-tables-mysql-Linux_2.2.13_SMP_alpha12
-rw-r--r--sql-bench/Results/connect-mysql-Linux_2.2.13_SMP_alpha20
-rw-r--r--sql-bench/Results/create-mysql-Linux_2.2.13_SMP_alpha14
-rw-r--r--sql-bench/Results/insert-mysql-Linux_2.2.13_SMP_alpha86
-rw-r--r--sql-bench/Results/select-mysql-Linux_2.2.13_SMP_alpha24
-rw-r--r--sql-bench/Results/wisconsin-mysql-Linux_2.2.13_SMP_alpha8
-rw-r--r--sql/gen_lex_hash.cc16
-rw-r--r--sql/ha_berkeley.cc510
-rw-r--r--sql/ha_berkeley.h16
-rw-r--r--sql/ha_innobase.cc16
-rw-r--r--sql/ha_myisam.cc2
-rw-r--r--sql/handler.cc14
-rw-r--r--sql/handler.h4
-rw-r--r--sql/log_event.cc2
-rw-r--r--sql/mysql_priv.h2
-rw-r--r--sql/mysqld.cc163
-rw-r--r--sql/sql_class.h2
-rw-r--r--sql/sql_show.cc23
-rw-r--r--sql/sql_table.cc8
-rw-r--r--sql/structs.h4
-rw-r--r--support-files/mysql.server.sh2
308 files changed, 10718 insertions, 1833 deletions
diff --git a/.bzrignore b/.bzrignore
index 47b47611d1d..b4a8e798fe9 100644
--- a/.bzrignore
+++ b/.bzrignore
@@ -181,3 +181,7 @@ mysql-test/mysql-test-run
BitKeeper/tmp/gone
mysqld.S
mysqld.sym
+.snprj/*
+sql-bench/output/*
+sql-bench/Results-linux/ATIS-mysql_bdb-Linux_2.2.14_my_SMP_i686
+Docs/my_sys.doc
diff --git a/BUILD/compile-pentium b/BUILD/compile-pentium
index cdbc7e773eb..5d197b48882 100755
--- a/BUILD/compile-pentium
+++ b/BUILD/compile-pentium
@@ -7,4 +7,10 @@ extra_flags="$pentium_cflags $fast_cflags"
extra_configs="$pentium_configs"
strip=yes
+# Use the optimized version if it exists
+if test -d /usr/local/BerkeleyDB-opt/
+then
+ extra_configs="$extra_configs --with-berkeley-db=/usr/local/BerkeleyDB-opt/"
+fi
+
. "$path/FINISH.sh"
diff --git a/BUILD/compile-pentium-debug b/BUILD/compile-pentium-debug
index 094c4e9ca86..45305661806 100755
--- a/BUILD/compile-pentium-debug
+++ b/BUILD/compile-pentium-debug
@@ -8,4 +8,10 @@ c_warnings="$c_warnings $debug_extra_warnings"
cxx_warnings="$cxx_warnings $debug_extra_warnings"
extra_configs="$pentium_configs $debug_configs"
+# Use the debug version if it exists
+if test -d /usr/local/BerkeleyDB-dbug/
+then
+ extra_configs="$extra_configs --with-berkeley-db=/usr/local/BerkeleyDB-dbug/"
+fi
+
. "$path/FINISH.sh"
diff --git a/BUILD/compile-pentium-symbols b/BUILD/compile-pentium-symbols
new file mode 100755
index 00000000000..4f63763606f
--- /dev/null
+++ b/BUILD/compile-pentium-symbols
@@ -0,0 +1,15 @@
+#! /bin/sh
+
+path=`dirname $0`
+. "$path/SETUP.sh"
+
+extra_flags="$pentium_cflags $fast_cflags -g"
+extra_configs="$pentium_configs"
+
+# Use the optimized version if it exists
+if test -d /usr/local/BerkeleyDB-opt/
+then
+ extra_configs="$extra_configs --with-berkeley-db=/usr/local/BerkeleyDB-opt/"
+fi
+
+. "$path/FINISH.sh"
diff --git a/Docs/internals.texi b/Docs/internals.texi
index 109946e75b6..9bbd90a7a3a 100644
--- a/Docs/internals.texi
+++ b/Docs/internals.texi
@@ -289,6 +289,151 @@ Use pointers rather than array indexing when operating on strings.
@end itemize
+@node mysys functions
+@chapter mysys functions
+
+Functions i mysys: (For flags se my_sys.h)
+
+ int my_copy _A((const char *from,const char *to,myf MyFlags));
+ - Copy file
+
+ int my_delete _A((const char *name,myf MyFlags));
+ - Delete file
+
+ int my_getwd _A((string buf,uint size,myf MyFlags));
+ int my_setwd _A((const char *dir,myf MyFlags));
+ - Get and set working directory
+
+ string my_tempnam _A((const char *pfx,myf MyFlags));
+ - Make a uniq temp file name by using dir and adding something after
+ pfx to make name uniq. Name is made by adding a uniq 6 length-string
+ and TMP_EXT after pfx.
+ Returns pointer to malloced area for filename. Should be freed by
+ free().
+
+ File my_open _A((const char *FileName,int Flags,myf MyFlags));
+ File my_create _A((const char *FileName,int CreateFlags,
+ int AccsesFlags, myf MyFlags));
+ int my_close _A((File Filedes,myf MyFlags));
+ uint my_read _A((File Filedes,byte *Buffer,uint Count,myf MyFlags));
+ uint my_write _A((File Filedes,const byte *Buffer,uint Count,
+ myf MyFlags));
+ ulong my_seek _A((File fd,ulong pos,int whence,myf MyFlags));
+ ulong my_tell _A((File fd,myf MyFlags));
+ - Use instead of open,open-with-create-flag, close read and write
+ to get automatic error-messages (flag: MYF_WME) and only have
+ to test for != 0 if error (flag: MY_NABP).
+
+ int my_rename _A((const char *from,const char *to,myf MyFlags));
+ - Rename file
+
+ FILE *my_fopen _A((const char *FileName,int Flags,myf MyFlags));
+ FILE *my_fdopen _A((File Filedes,int Flags,myf MyFlags));
+ int my_fclose _A((FILE *fd,myf MyFlags));
+ uint my_fread _A((FILE *stream,byte *Buffer,uint Count,myf MyFlags));
+ uint my_fwrite _A((FILE *stream,const byte *Buffer,uint Count,
+ myf MyFlags));
+ ulong my_fseek _A((FILE *stream,ulong pos,int whence,myf MyFlags));
+ ulong my_ftell _A((FILE *stream,myf MyFlags));
+ - Same read-interface for streams as for files
+
+ gptr _mymalloc _A((uint uSize,const char *sFile,
+ uint uLine, myf MyFlag));
+ gptr _myrealloc _A((string pPtr,uint uSize,const char *sFile,
+ uint uLine, myf MyFlag));
+ void _myfree _A((gptr pPtr,const char *sFile,uint uLine));
+ int _sanity _A((const char *sFile,unsigned int uLine));
+ gptr _myget_copy_of_memory _A((const byte *from,uint length,
+ const char *sFile, uint uLine,
+ myf MyFlag));
+ - malloc(size,myflag) is mapped to this functions if not compiled
+ with -DSAFEMALLOC
+
+ void TERMINATE _A((void));
+ - Writes malloc-info on stdout if compiled with -DSAFEMALLOC.
+
+ int my_chsize _A((File fd,ulong newlength,myf MyFlags));
+ - Change size of file
+
+ void my_error _D((int nr,myf MyFlags, ...));
+ - Writes message using error number (se mysys/errors.h) on
+ stdout or curses if MYSYS_PROGRAM_USES_CURSES() is called.
+
+ void my_message _A((const char *str,myf MyFlags));
+ - Writes message-string on
+ stdout or curses if MYSYS_PROGRAM_USES_CURSES() is called.
+
+ void my_init _A((void ));
+ - Start each program (in main) with this.
+ void my_end _A((int infoflag));
+ - Gives info about program.
+ - If infoflag & MY_CHECK_ERROR prints if some files are left open
+ - If infoflag & MY_GIVE_INFO prints timing info and malloc info
+ about prog.
+
+ int my_redel _A((const char *from, const char *to, int MyFlags));
+ - Delete from before rename of to to from. Copyes state from old
+ file to new file. If MY_COPY_TIME is set sets old time.
+
+ int my_copystat _A((const char *from, const char *to, int MyFlags));
+ - Copye state from old file to new file.
+ If MY_COPY_TIME is set sets copy also time.
+
+ string my_filename _A((File fd));
+ - Give filename of open file.
+
+ int dirname _A((string to,const char *name));
+ - Copy name of directory from filename.
+
+ int test_if_hard_path _A((const char *dir_name));
+ - Test if dirname is a hard path (Starts from root)
+
+ void convert_dirname _A((string name));
+ - Convert dirname acording to system.
+ - In MSDOS changes all caracters to capitals and changes '/' to
+ '\'
+ string fn_ext _A((const char *name));
+ - Returns pointer to extension in filename
+ string fn_format _A((string to,const char *name,const char *dsk,
+ const char *form,int flag));
+ format a filename with replace of library and extension and
+ converts between different systems.
+ params to and name may be identicall
+ function dosn't change name if name != to
+ Flag may be: 1 force replace filnames library with 'dsk'
+ 2 force replace extension with 'form' */
+ 4 force Unpack filename (replace ~ with home)
+ 8 Pack filename as short as possibly for output to
+ user.
+ All open requests should allways use at least:
+ "open(fn_format(temp_buffe,name,"","",4),...)" to unpack home and
+ convert filename to system-form.
+
+ string fn_same _A((string toname,const char *name,int flag));
+ - Copys directory and extension from name to toname if neaded.
+ copy can be forced by same flags that in fn_format.
+
+ int wild_compare _A((const char *str,const char *wildstr));
+ - Compare if str matches wildstr. Wildstr can contain "*" and "?"
+ as match-characters.
+ Returns 0 if match.
+
+ void get_date _A((string to,int timeflag));
+ - Get current date in a form ready for printing.
+
+ void soundex _A((string out_pntr, string in_pntr))
+ - Makes in_pntr to a 5 chars long string. All words that sounds
+ alike have the same string.
+
+ int init_key_cache _A((ulong use_mem,ulong leave_this_much_mem));
+ - Use cacheing of keys in MISAM, PISAM, and ISAM.
+ KEY_CACHE_SIZE is a good size.
+ - Remember to lock databases for optimal cacheing
+
+ void end_key_cache _A((void));
+ - End key-cacheing.
+
+
@c The Index was empty, and ugly, so I removed it. (jcole, Sep 7, 2000)
@c @node Index
diff --git a/Docs/manual.texi b/Docs/manual.texi
index 6a3a762efb5..e6d8f210b80 100644
--- a/Docs/manual.texi
+++ b/Docs/manual.texi
@@ -135,6 +135,7 @@ version see the relevant distribution.
* MySQL internals:: @strong{MySQL} internals
* Environment variables:: @strong{MySQL} environment variables
* Users:: Some @strong{MySQL} users
+* MySQL customer usage::
* Contrib:: Contributed programs
* Credits:: Contributors to @strong{MySQL}
* News:: @strong{MySQL} change history
@@ -192,7 +193,7 @@ Example Licensing Situations
* ISP:: ISP @strong{MySQL} services
* Web server:: Running a web server using @strong{MySQL}.
-@strong{MySQL} Licensing and Support Costs
+MySQL Licensing and Support Costs
* Payment information:: Payment information
* Contact information:: Contact information
@@ -222,7 +223,7 @@ Installing MySQL
* OS/2:: OS/2 notes
* MySQL binaries:: MySQL binaries
* Post-installation:: Post-installation setup and testing
-* Upgrade:: Upgrading/downgrading @strong{MySQL}
+* Upgrade:: Upgrading/Downgrading MySQL
Installing a MySQL Binary Distribution
@@ -828,6 +829,7 @@ Credits
* Developers::
* Contributors::
+* Supporters::
MySQL change history
@@ -876,7 +878,7 @@ Changes in release 3.23.x (Recommended; Gamma)
* News-3.23.1:: Changes in release 3.23.1
* News-3.23.0:: Changes in release 3.23.0
-Changes in release 3.22.x
+Changes in release 3.22.x (Older; Still supported)
* News-3.22.35:: Changes in release 3.22.35
* News-3.22.34:: Changes in release 3.22.34
@@ -1814,7 +1816,8 @@ In-memory hash tables which are used as temporary tables.
@item
Handles large databases. We are using @strong{MySQL} with some
-databases that contain 50,000,000 records.
+databases that contain 50,000,000 records and we know of users that
+uses @code{MySQL} with 60,000 tables and about 5,000,000,000 rows
@item
All columns have default values. You can use @code{INSERT} to insert a
@@ -2568,7 +2571,7 @@ PMP Computer Solutions. Database developers using @strong{MySQL} and
@item @uref{http://www.aewa.org/}@*
Airborne Early Warning Association.
-@item @uref{http://21ccs.com/~gboersm/y2kmatrix/}@*
+@item @uref{http://www.dedserius.com/y2kmatrix/}@*
Y2K tester.
@end itemize
@@ -4490,9 +4493,15 @@ China [linuxforum.net] @
@item
@c EMAIL: Vincent_Fong@innovator.com.hk (Vincent Fong)
@c @image{Flags/china}
-China [Hong Kong] @
+China [ISL/Hong Kong] @
@uref{http://mysql.islnet.net, WWW}
+@item
+@c EMAIL: marquischan@hotmail.com (Marquis Chan)
+@c @image{Flags/china}
+China [TraLand.com/Hong Kong] @
+@uref{http://www.traland.com/mysql/, WWW}
+
@c @item
@c Not ok 20000919; Non-existent (Matt)
@c EMAIL: george@netfirm.net (Hongsheng Zhu)
@@ -9465,16 +9474,13 @@ section in this manual. @xref{SHOW VARIABLES}.
The tuning server parameters section includes information of how to optimize
these. @xref{Server parameters}.
-@item -Sg, --skip-grant-tables
-This option causes the server not to use the privilege system at all. This
-gives everyone @emph{full access} to all databases! (You can tell a running
-server to start using the grant tables again by executing @code{mysqladmin
-flush-privileges} or @code{mysqladmin reload}.)
-
@item --safe-mode
Skip some optimize stages.
Implies @code{--skip-delay-key-write}.
+@item --safe-show-database
+Don't show databases for which the user doesn't have any privileges.
+
@item --secure
IP numbers returned by the @code{gethostbyname()} system call are
checked to make sure they resolve back to the original hostname. This
@@ -9494,6 +9500,12 @@ in this feature).
Ignore the @code{delay_key_write} option for all tables.
@xref{Server parameters}.
+@item -Sg, --skip-grant-tables
+This option causes the server not to use the privilege system at all. This
+gives everyone @emph{full access} to all databases! (You can tell a running
+server to start using the grant tables again by executing @code{mysqladmin
+flush-privileges} or @code{mysqladmin reload}.)
+
@item --skip-locking
Don't use system locking. To use @code{isamchk} or @code{myisamchk} you must
shut down the server. @xref{Stability}. Note that in @strong{MySQL} Version
@@ -20242,72 +20254,85 @@ The output resembles that shown below, though the format and numbers may
differ somewhat:
@example
-+-------------------------+---------------------------------+
-| Variable_name | Value |
-+-------------------------+---------------------------------+
-| ansi_mode | OFF |
-| back_log | 50 |
-| basedir | /usr/local/mysql/ |
-| bdb_cache_size | 1048540 |
-| bdb_home | /usr/local/mysql/data/ |
-| bdb_logdir | |
-| bdb_tmpdir | /tmp/ |
-| binlog_cache_size | 32768 |
-| character_set | latin1 |
-| character_sets | latin1 |
-| connect_timeout | 5 |
-| concurrent_insert | ON |
-| datadir | /usr/local/mysql/data/ |
-| delay_key_write | ON |
-| delayed_insert_limit | 100 |
-| delayed_insert_timeout | 300 |
-| delayed_queue_size | 1000 |
-| join_buffer_size | 131072 |
-| flush | OFF |
-| flush_time | 0 |
-| init_file | |
-| interactive_timeout | 28800 |
-| key_buffer_size | 16776192 |
-| language | /usr/local/mysql/share/english/ |
-| log | OFF |
-| log_update | OFF |
-| log_bin | OFF |
-| log_slave_updates | OFF |
-| long_query_time | 10 |
-| low_priority_updates | OFF |
-| lower_case_table_names | 0 |
-| max_allowed_packet | 1047552 |
-| max_connections | 100 |
-| max_connect_errors | 10 |
-| max_delayed_threads | 20 |
-| max_heap_table_size | 16777216 |
-| max_join_size | 4294967295 |
-| max_sort_length | 1024 |
-| max_tmp_tables | 32 |
-| max_write_lock_count | 4294967295 |
-| myisam_sort_buffer_size | 8388608 |
-| net_buffer_length | 16384 |
-| net_retry_count | 10 |
-| open_files_limit | 0 |
-| pid_file | /usr/local/mysql/data/tik.pid |
-| port | 3306 |
-| protocol_version | 10 |
-| record_buffer | 131072 |
-| skip_locking | ON |
-| skip_networking | OFF |
-| skip_show_database | OFF |
-| slow_launch_time | 2 |
-| socket | /tmp/mysql.sock |
-| sort_buffer | 2097116 |
-| table_cache | 64 |
-| table_type | MYISAM |
-| thread_stack | 131072 |
-| thread_cache_size | 3 |
-| tmp_table_size | 1048576 |
-| tmpdir | /tmp/ |
-| version | 3.23.21-beta-debug |
-| wait_timeout | 28800 |
-+-------------------------+---------------------------------+
++-------------------------+---------------------------+
+| Variable_name | Value |
++-------------------------+---------------------------+
+| ansi_mode | OFF |
+| back_log | 50 |
+| basedir | /my/monty/ |
+| bdb_cache_size | 16777216 |
+| bdb_home | /my/monty/data/ |
+| bdb_max_lock | 10000 |
+| bdb_logdir | |
+| bdb_shared_data | OFF |
+| bdb_tmpdir | /tmp/ |
+| binlog_cache_size | 32768 |
+| concurrent_insert | ON |
+| connect_timeout | 5 |
+| datadir | /my/monty/data/ |
+| delay_key_write | ON |
+| delayed_insert_limit | 100 |
+| delayed_insert_timeout | 300 |
+| delayed_queue_size | 1000 |
+| flush | OFF |
+| flush_time | 0 |
+| have_bdb | YES |
+| have_gemini | NO |
+| have_innobase | YES |
+| have_raid | YES |
+| have_ssl | NO |
+| init_file | |
+| interactive_timeout | 28800 |
+| join_buffer_size | 131072 |
+| key_buffer_size | 16776192 |
+| language | /my/monty/share/english/ |
+| large_files_support | ON |
+| log | OFF |
+| log_update | OFF |
+| log_bin | OFF |
+| log_slave_updates | OFF |
+| long_query_time | 10 |
+| low_priority_updates | OFF |
+| lower_case_table_names | 0 |
+| max_allowed_packet | 1048576 |
+| max_binlog_cache_size | 4294967295 |
+| max_connections | 100 |
+| max_connect_errors | 10 |
+| max_delayed_threads | 20 |
+| max_heap_table_size | 16777216 |
+| max_join_size | 4294967295 |
+| max_sort_length | 1024 |
+| max_tmp_tables | 32 |
+| max_write_lock_count | 4294967295 |
+| myisam_recover_options | DEFAULT |
+| myisam_sort_buffer_size | 8388608 |
+| net_buffer_length | 16384 |
+| net_read_timeout | 30 |
+| net_retry_count | 10 |
+| net_write_timeout | 60 |
+| open_files_limit | 0 |
+| pid_file | /my/monty/data/donna.pid |
+| port | 3306 |
+| protocol_version | 10 |
+| record_buffer | 131072 |
+| query_buffer_size | 0 |
+| safe_show_database | OFF |
+| server_id | 0 |
+| skip_locking | ON |
+| skip_networking | OFF |
+| skip_show_database | OFF |
+| slow_launch_time | 2 |
+| socket | /tmp/mysql.sock |
+| sort_buffer | 2097116 |
+| table_cache | 64 |
+| table_type | MYISAM |
+| thread_cache_size | 4 |
+| thread_stack | 65536 |
+| tmp_table_size | 1048576 |
+| tmpdir | /tmp/ |
+| version | 3.23.29a-gamma-debug |
+| wait_timeout | 28800 |
++-------------------------+---------------------------+
@end example
Each option is described below. Values for buffer sizes, lengths, and stack
@@ -20427,6 +20452,21 @@ tables will be closed (to free up resources and sync things to disk). We
only recommend this option on Win95, Win98, or on systems where you have
very little resources.
+@item @code{have_bdb}
+@code{YES} if @code{mysqld} supports Berkeley DB tables. @code{DISABLED}
+if @code{--skip-bdb} is used.
+@item @code{have_gemini}
+@code{YES} if @code{mysqld} supports Gemini tables. @code{DISABLED}
+if @code{--skip-gemini} is used.
+@item @code{have_innobase}
+@code{YES} if @code{mysqld} supports Innobase tables. @code{DISABLED}
+if @code{--skip-innobase} is used.
+@item @code{have_raid}
+@code{YES} if @code{mysqld} supports the @code{RAID} option.
+@item @code{have_ssl}
+@code{YES} if @code{mysqld} supports SSL (encryption) on the client/server
+protocol.
+
@item @code{init_file}
The name of the file specified with the @code{--init-file} option when
you start the server. This is a file of SQL statements you want the
@@ -20606,6 +20646,12 @@ want to increase this value.
The initial allocation of the query buffer. If most of your queries are
long (like when inserting blobs), you should increase this!
+@item @code{safe_show_databases}
+Don't show databases for which the user doesn't have any database or
+table privileges. This can improve security if you're concerned about
+people being able to see what databases other users have. See also
+@code{skip_show_databases}.
+
@item @code{server_id}
The value of the @code{--server-id} option.
@@ -20616,10 +20662,10 @@ Is OFF if @code{mysqld} uses external locking.
Is ON if we only allow local (socket) connections.
@item @code{skip_show_databases}
-This prevents people from doing @code{SHOW DATABASES} if they don't
-have the @code{PROCESS_PRIV} privilege. This can improve security if
-you're concerned about people being able to see what databases and
-tables other users have.
+This prevents people from doing @code{SHOW DATABASES} if they don't have
+the @code{PROCESS_PRIV} privilege. This can improve security if you're
+concerned about people being able to see what databases other users
+have. See also @code{safe_show_databases}.
@item @code{slow_launch_time}
If creating the thread takes longer than this value (in seconds), the
@@ -28399,20 +28445,20 @@ Most of the options to @code{safe_mysqld} are the same as the options to
@table @code
@item --basedir=path
@item --core-file-size=#
+@item --datadir=path
@item --defaults-extra-file=path
@item --defaults-file=path
-@item --open-files=#
-Size of the core file @code{mysqld} should be able to create. Passed to
-@code{ulimit -c}.
-@item --datadir=path
@item --err-log=path
@item --ledir=path
Path to @code{mysqld}
@item --log=path
+@item --mysqld=mysqld-version
+Name of the mysqld version in the @code{ledir} directory you want to start.
@item --no-defaults
@item --open-files=#
-Number of files @code{mysqld} should be able to open. Passed to
-@code{ulimit -n}.
+Number of files @code{mysqld} should be able to open. Passed to @code{ulimit -n}.
+@item --open-files=#
+Size of the core file @code{mysqld} should be able to create. Passed to @code{ulimit -c}.
@item --pid-file=path
@item --port=#
@item --socket=path
@@ -38243,10 +38289,11 @@ To be consistent with our setup, you should put your result files in
test produces more than one result, you should use @code{test_name.a.result},
@code{test_name.b.result}, etc
@item
-Failed test results are put in a file with the same name as the result file
-followed by @code{.reject} extenstion. If your test case is failing, you
-should do a diff on the two files. If you cannot see how they are different,
-examine both with @code{od -c} and also check their lengths.
+Failed test results are put in a file with the same base name as the
+result file with the @code{.reject} extenstion. If your test case is
+failing, you should do a diff on the two files. If you cannot see how
+they are different, examine both with @code{od -c} and also check their
+lengths.
@item
You can prefix a query with @code{!} if the test can continue after that query
returns an error.
@@ -38284,9 +38331,6 @@ you should ftp all the relevant files to
@end itemize
-
-
-
@page
@cindex environment variables, list of
@node Environment variables, Users, MySQL internals, Top
@@ -38371,7 +38415,7 @@ variables to modify the behavior of @strong{MySQL}. @xref{Option files}.
@page
@cindex users, of MySQL
@cindex news sites
-@node Users, Contrib, Environment variables, Top
+@node Users, MySQL customer usage, Environment variables, Top
@appendix Some MySQL Users
@appendixsec General News Sites
@@ -38519,6 +38563,8 @@ support @strong{MySQL}}
@c @item @uref{http://dynodns.net, Free dynamic DNS implementation}
@c EMAIL: A Moore <amoore@mooresystems.com>
+@item @uref{http://www.hn.org/, Hammernode; Public DNS Servers}
+
@item @uref{http://www.fdns.net/, Free 3rd level domains}
@item @uref{http://worldcommunity.com/, Online Database}
@@ -38774,9 +38820,43 @@ Washington's Eastside residents and businesses}
Send any additions to this list to @email{webmaster@@mysql.com}.
@page
+@cindex MySQL usage
+@node MySQL customer usage, Contrib, Users, Top
+@appendix MySQL customer usage
+
+The section 'Some MySQL Users' contains a lot of different links to
+@strong{MySQL} users but doesn't provide that much information about how
+they are using @strong{MySQL}. @xref{Users}. This manual section is to
+give you an idea of how other @strong{MySQL} users are using
+@strong{MySQL} to solve their problems.
+
+This manual section is very new and we plan to add more stories here
+shortly. If you are interested in contributing of how you use
+@code{MySQL} in a unique environment or have success store about how you
+use @code{MySQL}, you can write to @code{docs@@lists.mysql.com} with
+subject @code{Success:}. Note that as we are very busy it may take some
+time before you get some feedback for your story.
+
+@itemize @bullet
+@item
+I think you might be interested in my database size. The whole database
+is currently on 15 servers and I think it's about 60.000 of tables
+containing about 5.000.000.000 of rows. My mostly loaded server
+currently holds about 10.000 of tables with 1.000.000.000 of rows in it.
+Hugest tables have about 50.000.000 of rows, and this value will raise
+as soon as I'll move to 2.4 kernel with large files. Currently I have to
+delete much of logs for large sites to hold table sizes in 2Gb.
+
+Peter Zaitsev, Spylog.ru.
+@item
+Texas Instrument is using MySQL for handling tables that contains up
+o 2,000 million rows in a validation regression database.
+@end itemize
+
+@page
@cindex contributed programs
@cindex programs, contributed
-@node Contrib, Credits, Users, Top
+@node Contrib, Credits, MySQL customer usage, Top
@appendix Contributed Programs
Many users of @strong{MySQL} have contributed @emph{very} useful support
@@ -38967,6 +39047,9 @@ applications. By Miguel Angel Solórzano.
@item @uref{http://www.mysql.com/Downloads/Contrib/MySQL-ADA95_API.zip, MySQL-ADA95_API.zip}
An ADA95 interface to the MySQL API. By Francois Fabien.
+@item @uref{http://www.mysql.com/Downloads/Contrib/MyTool-DLL_for_VB_and_MySQL.zip, MyTool-DLL_for_VB_and_MySQL.zip}
+A DLL with MySQL C API for Visual Basic. By Ken Menzel @email{kenm@@icarz.com}.
+
@end itemize
@appendixsec Clients
@@ -39445,12 +39528,14 @@ interested in.
@node Credits, News, Contrib, Top
@appendix Credits
-The following persons have helped us make MySQL what it is today
+The following persons and companies have helped us make MySQL what it is
+today:
@cindex developers, list of
@menu
* Developers::
* Contributors::
+* Supporters::
@end menu
@node Developers, Contributors, Credits, Credits
@@ -39632,7 +39717,7 @@ Allan Larsson (The BOSS for TCX DataKonsult AB).
@end table
@cindex contributors, list of
-@node Contributors, , Developers, Credits
+@node Contributors, Supporters, Developers, Credits
@appendixsubsec Contributors to MySQL
Contributors to the @strong{MySQL} distribution are listed below, in
@@ -39702,6 +39787,12 @@ For porting PHP to @strong{MySQL}.
For the first @strong{MySQL} manual. And a lot of spelling/language
fixes for the FAQ (that turned into the @strong{MySQL} manual a long
time ago).
+@item Yan Cailin
+First translator of the MySQL Reference Manual into simplified chinese
+in early 2000 on which the Big5 and HK coded
+(@uref{http://mysql.hitstar.com, mysql.hitstar.com}) versions were
+based. @uref{http://linuxdb.yeah.net, Personal home page at
+linuxdb.yeah.net}.
@item Giovanni Maruzzelli @email{maruzz@@matrice.it}
For porting iODBC (Unix ODBC).
@item Chris Provenzano
@@ -39857,6 +39948,24 @@ ODBC and VisualC++ interface questions.
@code{DBD}, Linux, some SQL syntax questions.
@end table
+@cindex contributing companies, list of
+@node Supporters, , Contributors, Credits
+@appendixsubsec Supporters to MySQL
+
+The following companies has helped us finance development of
+@strong{MySQL} by either paying us for developing a new feature,
+developed a @strong{MySQL} feature themself or by giving us hardware for
+@strong{MySQL} development.
+
+@multitable @columnfractions .3 .7
+@item Va Linux / Andover.net @tab Replication
+@item NuSphere @tab Editing of the @strong{MySQL} manual.
+@item Intel @tab Contributed to development on Windows and Linux platforms
+@item Compaq @tab Contributed to Development on Linux-alpha
+@item SWSoft @tab Development on the embedded @code{mysqld} version.
+@item FutureQuest @tab @code{--skip-show-variables}
+@end multitable
+
@node News, Bugs, Credits, Top
@appendix MySQL change history
@@ -39948,6 +40057,18 @@ though, so Version 3.23 is not released as a stable version yet.
@appendixsubsec Changes in release 3.23.30
@itemize @bullet
@item
+Added option @code{--mysqld=#} to @code{safe_mysqld}
+@item
+Allow hex constants in the @code{--fields-*-by} and
+@code{--lines-terminated-by} options to @code{mysqldump} and
+@code{mysqlimport}. By Paul DuBois.
+@item
+Added option @code{--safe-show-databases}.
+@item
+Added @code{have_bdb}, @code{have_gemini}, @code{have_innobase},
+@code{have_raid} and @code{have_ssl} to @code{SHOW VARIABLES} to make it
+easy to test for supported extensions.
+@item
Added option @code{open-files-limit} to @code{mysqld}.
@item
Changed option @code{open-files} to @code{open-files-limit} in
diff --git a/client/my_readline.h b/client/my_readline.h
index c9a0e863870..547587bc19d 100644
--- a/client/my_readline.h
+++ b/client/my_readline.h
@@ -26,6 +26,7 @@ typedef struct st_line_buffer
uint bufread; /* Number of bytes to get with each read(). */
uint eof;
ulong max_size;
+ ulong read_length; /* Length of last read string */
} LINE_BUFFER;
extern LINE_BUFFER *batch_readline_init(ulong max_size,FILE *file);
diff --git a/client/mysql.cc b/client/mysql.cc
index 30e7d75ecaa..dbd7bfbf899 100644
--- a/client/mysql.cc
+++ b/client/mysql.cc
@@ -39,7 +39,7 @@
#include "my_readline.h"
#include <signal.h>
-const char *VER="11.9";
+const char *VER="11.10";
gptr sql_alloc(unsigned size); // Don't use mysqld alloc for these
void sql_element_free(void *ptr);
@@ -903,7 +903,6 @@ static bool add_line(String &buffer,char *line,char *in_string)
continue;
#ifdef USE_MB
int l;
-/* if ((l = ismbchar(pos, pos+MBMAXLEN))) { Wei He: I think it's wrong! */
if (use_mb(default_charset_info) &&
(l = my_ismbchar(default_charset_info, pos, strend))) {
while (l--)
@@ -2163,7 +2162,9 @@ com_status(String *buffer __attribute__((unused)),
tee_fprintf(stdout, "Server version:\t\t%s\n", mysql_get_server_info(&mysql));
tee_fprintf(stdout, "Protocol version:\t%d\n", mysql_get_proto_info(&mysql));
tee_fprintf(stdout, "Connection:\t\t%s\n", mysql_get_host_info(&mysql));
- tee_fprintf(stdout, "Language:\t\t%s\n", mysql.charset->name);
+ tee_fprintf(stdout, "Client characterset:\t%s\n",
+ default_charset_info->name);
+ tee_fprintf(stdout, "Server characterset:\t%s\n", mysql.charset->name);
if (strstr(mysql_get_host_info(&mysql),"TCP/IP") || ! mysql.unix_socket)
tee_fprintf(stdout, "TCP port:\t\t%d\n", mysql.port);
else
diff --git a/client/mysqladmin.c b/client/mysqladmin.c
index 6488d012c1a..35f7f341247 100644
--- a/client/mysqladmin.c
+++ b/client/mysqladmin.c
@@ -122,7 +122,6 @@ static struct option long_options[] = {
{"socket", required_argument, 0, 'S'},
{"sleep", required_argument, 0, 'i'},
#include "sslopt-longopts.h"
- {"connect-timeout", required_argument, 0, 't'},
#ifndef DONT_ALLOW_USER_CHANGE
{"user", required_argument, 0, 'u'},
#endif
diff --git a/client/mysqldump.c b/client/mysqldump.c
index f27f5c5e35b..9c5c4d34ca5 100644
--- a/client/mysqldump.c
+++ b/client/mysqldump.c
@@ -37,7 +37,7 @@
** Tõnu Samuel <tonu@please.do.not.remove.this.spam.ee>
**/
-#define DUMP_VERSION "8.11"
+#define DUMP_VERSION "8.12"
#include <global.h>
#include <my_sys.h>
@@ -863,9 +863,14 @@ static char *add_load_option(char *ptr,const char *object,
{
if (object)
{
- ptr= strxmov(ptr," ",statement," '",NullS);
- ptr= field_escape(ptr,object,(uint) strlen(object));
- *ptr++= '\'';
+ if (!strncasecmp(object,"0x",2)) /* hex constant; don't escape */
+ ptr= strxmov(ptr," ",statement," ",object,NullS);
+ else /* char constant; escape */
+ {
+ ptr= strxmov(ptr," ",statement," '",NullS);
+ ptr= field_escape(ptr,object,(uint) strlen(object));
+ *ptr++= '\'';
+ }
}
return ptr;
} /* add_load_option */
diff --git a/client/mysqlimport.c b/client/mysqlimport.c
index d00c99d4061..4ca6edf21f2 100644
--- a/client/mysqlimport.c
+++ b/client/mysqlimport.c
@@ -25,7 +25,7 @@
** * *
** *************************
*/
-#define IMPORT_VERSION "2.6"
+#define IMPORT_VERSION "2.7"
#include <global.h>
#include <my_sys.h>
@@ -456,9 +456,14 @@ static char *add_load_option(char *ptr,const char *object,const char *statement)
{
if (object)
{
- ptr= strxmov(ptr," ",statement," '",NullS);
- ptr= field_escape(ptr,object,(uint) strlen(object));
- *ptr++= '\'';
+ if (!strncasecmp(object,"0x",2)) /* hex constant; don't escape */
+ ptr= strxmov(ptr," ",statement," ",object,NullS);
+ else /* char constant; escape */
+ {
+ ptr= strxmov(ptr," ",statement," '",NullS);
+ ptr= field_escape(ptr,object,(uint) strlen(object));
+ *ptr++= '\'';
+ }
}
return ptr;
}
diff --git a/client/mysqltest.c b/client/mysqltest.c
index 98ef9c99399..d65d451f408 100644
--- a/client/mysqltest.c
+++ b/client/mysqltest.c
@@ -20,10 +20,10 @@
* Written by:
* Sasha Pachev <sasha@mysql.com>
* Matt Wagner <matt@mysql.com>
- *
+ * Monty
**/
-#define MTEST_VERSION "1.0"
+#define MTEST_VERSION "1.2"
#include "global.h"
#include "my_sys.h"
@@ -41,25 +41,27 @@
#include <unistd.h>
#include <errno.h>
-#define MAX_QUERY 16384
-#define PAD_SIZE 128
+#define MAX_QUERY 65536
+#define PAD_SIZE 128
#define MAX_CONS 1024
#define MAX_INCLUDE_DEPTH 16
#define LAZY_GUESS_BUF_SIZE 8192
-#define INIT_Q_LINES 1024
-#define MIN_VAR_ALLOC 32
+#define INIT_Q_LINES 1024
+#define MIN_VAR_ALLOC 32
#define BLOCK_STACK_DEPTH 32
int record = 0, verbose = 0, silent = 0;
-const char* record_mode = "r";
static char *db = 0, *pass=0;
const char* user = 0, *host = 0, *unix_sock = 0;
int port = 0;
+static uint start_lineno, *lineno;
+
static const char *load_default_groups[]= { "mysqltest","client",0 };
FILE* file_stack[MAX_INCLUDE_DEPTH];
FILE** cur_file;
FILE** file_stack_end;
+uint lineno_stack[MAX_INCLUDE_DEPTH];
int block_stack[BLOCK_STACK_DEPTH];
int *cur_block, *block_stack_end;
@@ -100,21 +102,31 @@ VAR var_reg[10];
struct connection cons[MAX_CONS];
struct connection* cur_con, *next_con, *cons_end;
-/* this should really be called command*/
+/* this should really be called command */
struct query
{
char q[MAX_QUERY];
- int has_result_set;
int first_word_len;
- int abort_on_error;
+ my_bool abort_on_error, require_file;
uint expected_errno;
char record_file[FN_REFLEN];
- enum {Q_CONNECTION, Q_QUERY, Q_CONNECT,
- Q_SLEEP, Q_INC, Q_DEC,Q_SOURCE,
- Q_DISCONNECT,Q_LET, Q_ECHO, Q_WHILE, Q_END_BLOCK,
- Q_SYSTEM, Q_UNKNOWN} type;
+ /* Add new commands before Q_UNKNOWN */
+ enum { Q_CONNECTION=1, Q_QUERY, Q_CONNECT,
+ Q_SLEEP, Q_INC, Q_DEC,Q_SOURCE,
+ Q_DISCONNECT,Q_LET, Q_ECHO, Q_WHILE, Q_END_BLOCK,
+ Q_SYSTEM, Q_RESULT, Q_REQUIRE,
+ Q_UNKNOWN, Q_COMMENT, Q_COMMENT_WITH_COMMAND} type;
};
+const char *command_names[] = {
+"connection", "query","connect","sleep","inc","dec","source","disconnect",
+"let","echo","while","end","system","result", "require",0
+};
+
+TYPELIB command_typelib= {array_elements(command_names),"",
+ command_names};
+
+
#define DS_CHUNK 16384
typedef struct dyn_string
@@ -131,11 +143,53 @@ void dyn_string_append(DYN_STRING* ds, const char* str, int len);
int dyn_string_cmp(DYN_STRING* ds, const char* fname);
void reject_dump(const char* record_file, char* buf, int size);
-
-static void die(const char* fmt, ...);
int close_connection(struct query* q);
VAR* var_get(char* var_name, char* var_name_end, int raw);
-void verbose_msg(const char* fmt, ...);
+
+static void close_cons()
+{
+ for(--next_con; next_con >= cons; --next_con)
+ {
+ mysql_close(&next_con->mysql);
+ my_free(next_con->name, MYF(MY_ALLOW_ZERO_PTR));
+ }
+}
+
+static void die(const char* fmt, ...)
+{
+ va_list args;
+ va_start(args, fmt);
+ fprintf(stderr, "%s: ", my_progname);
+ vfprintf(stderr, fmt, args);
+ fprintf(stderr, "\n");
+ va_end(args);
+ close_cons();
+ exit(1);
+}
+
+static void abort_not_supported_test()
+{
+ fprintf(stderr, "This test is not supported by this installation\n");
+ if (!silent)
+ printf("skipped\n");
+ close_cons();
+ exit(2);
+}
+
+static void verbose_msg(const char* fmt, ...)
+{
+ va_list args;
+
+ if (!verbose) return;
+
+ va_start(args, fmt);
+
+ fprintf(stderr, "%s: At line %u: ", my_progname, start_lineno);
+ vfprintf(stderr, fmt, args);
+ fprintf(stderr, "\n");
+ va_end(args);
+}
+
void init_parser()
{
@@ -145,9 +199,9 @@ void init_parser()
int hex_val(int c)
{
- if(isdigit(c))
+ if (isdigit(c))
return c - '0';
- else if((c = tolower(c)) >= 'a' && c <= 'f')
+ else if ((c = tolower(c)) >= 'a' && c <= 'f')
return c - 'a' + 10;
else
return -1;
@@ -155,7 +209,7 @@ int hex_val(int c)
void dyn_string_init(DYN_STRING* ds)
{
- if(!(ds->str = (char*)my_malloc(DS_CHUNK, MYF(0))))
+ if (!(ds->str = (char*)my_malloc(DS_CHUNK, MYF(0))))
die("Out of memory");
ds->len = 0;
ds->max_len = DS_CHUNK;
@@ -170,14 +224,14 @@ void dyn_string_end(DYN_STRING* ds)
void dyn_string_append(DYN_STRING* ds, const char* str, int len)
{
int new_len;
- if(!len)
+ if (!len)
len = strlen(str);
new_len = ds->len + len;
- if(new_len > ds->max_len)
+ if (new_len > ds->max_len)
{
int new_alloc_len = (new_len & ~(DS_CHUNK-1)) + DS_CHUNK;
char* tmp = (char*) my_malloc(new_alloc_len, MYF(0));
- if(!tmp)
+ if (!tmp)
die("Out of memory");
memcpy(tmp, ds->str, ds->len);
memcpy(tmp + ds->len, str, len);
@@ -192,21 +246,23 @@ void dyn_string_append(DYN_STRING* ds, const char* str, int len)
ds->len += len;
}
}
+
+
int dyn_string_cmp(DYN_STRING* ds, const char* fname)
{
MY_STAT stat_info;
char *tmp;
int res;
int fd;
- if(!my_stat(fname, &stat_info, MYF(MY_WME)))
+ if (!my_stat(fname, &stat_info, MYF(MY_WME)))
die("Could not stat %s: errno =%d", fname, errno);
- if(stat_info.st_size != ds->len)
+ if (stat_info.st_size != ds->len)
return 2;
- if(!(tmp = (char*) my_malloc(ds->len, MYF(0))))
+ if (!(tmp = (char*) my_malloc(ds->len, MYF(0))))
die("Out of memory");
- if((fd = my_open(fname, O_RDONLY, MYF(MY_WME))) < 0)
+ if ((fd = my_open(fname, O_RDONLY, MYF(MY_WME))) < 0)
die("Could not open %s: errno = %d", fname, errno);
- if(my_read(fd, (byte*)tmp, stat_info.st_size, MYF(MY_WME|MY_NABP)))
+ if (my_read(fd, (byte*)tmp, stat_info.st_size, MYF(MY_WME|MY_NABP)))
die("read failed");
res = (memcmp(tmp, ds->str, stat_info.st_size)) ? 1 : 0;
my_free((gptr)tmp, MYF(0));
@@ -214,25 +270,30 @@ int dyn_string_cmp(DYN_STRING* ds, const char* fname)
return res;
}
-int check_result(DYN_STRING* ds, const char* fname)
+static int check_result(DYN_STRING* ds, const char* fname,
+ my_bool require_option)
{
int error = 0;
- switch(dyn_string_cmp(ds, fname))
- {
- case 0:
- break; /* ok */
- case 2:
- verbose_msg("Result length mismatch");
- error = 1;
- break;
- case 1:
- verbose_msg("Result content mismatch");
- error = 1;
- break;
- default: /* impossible */
- die("Unknown error code from dyn_string_cmp()");
- }
- if(error)
+ int res=dyn_string_cmp(ds, fname);
+
+ if (res && require_option)
+ abort_not_supported_test();
+ switch (res)
+ {
+ case 0:
+ break; /* ok */
+ case 2:
+ verbose_msg("Result length mismatch");
+ error = 1;
+ break;
+ case 1:
+ verbose_msg("Result content mismatch");
+ error = 1;
+ break;
+ default: /* impossible */
+ die("Unknown error code from dyn_string_cmp()");
+ }
+ if (error)
reject_dump(fname, ds->str, ds->len);
return error;
}
@@ -241,26 +302,26 @@ VAR* var_get(char* var_name, char* var_name_end, int raw)
{
int digit;
VAR* v;
- if(*var_name++ != '$')
- {
- --var_name;
- goto err;
- }
+ if (*var_name++ != '$')
+ {
+ --var_name;
+ goto err;
+ }
digit = *var_name - '0';
- if(!(digit < 10 && digit >= 0))
- {
- --var_name;
- goto err;
- }
+ if (!(digit < 10 && digit >= 0))
+ {
+ --var_name;
+ goto err;
+ }
v = var_reg + digit;
- if(!raw && v->int_dirty)
- {
- sprintf(v->str_val, "%d", v->int_val);
- v->int_dirty = 0;
- }
+ if (!raw && v->int_dirty)
+ {
+ sprintf(v->str_val, "%d", v->int_val);
+ v->int_dirty = 0;
+ }
return v;
- err:
- if(var_name_end)
+err:
+ if (var_name_end)
*var_name_end = 0;
die("Unsupported variable name: %s", var_name);
return 0;
@@ -272,23 +333,23 @@ int var_set(char* var_name, char* var_name_end, char* var_val,
int digit;
int val_len;
VAR* v;
- if(*var_name++ != '$')
+ if (*var_name++ != '$')
{
--var_name;
*var_name_end = 0;
die("Variable name in %s does not start with '$'", var_name);
}
digit = *var_name - '0';
- if(!(digit < 10 && digit >= 0))
+ if (!(digit < 10 && digit >= 0))
{
*var_name_end = 0;
die("Unsupported variable name: %s", var_name);
}
v = var_reg + digit;
- if(v->alloced_len < (val_len = (int)(var_val_end - var_val)+1))
+ if (v->alloced_len < (val_len = (int)(var_val_end - var_val)+1))
{
v->alloced_len = (val_len < MIN_VAR_ALLOC) ? MIN_VAR_ALLOC : val_len;
- if(!(v->str_val =
+ if (!(v->str_val =
v->str_val ? my_realloc(v->str_val, v->alloced_len, MYF(MY_WME)) :
my_malloc(v->alloced_len, MYF(MY_WME))))
die("Out of memory");
@@ -302,10 +363,11 @@ int var_set(char* var_name, char* var_name_end, char* var_val,
int open_file(const char* name)
{
- if(*cur_file && ++cur_file == file_stack_end)
+ if (*cur_file && ++cur_file == file_stack_end)
die("Source directives are nesting too deep");
- if(!(*cur_file = fopen(name, "r")))
+ if (!(*cur_file = my_fopen(name, O_RDONLY, MYF(MY_WME))))
die("Could not read '%s': errno %d\n", name, errno);
+ *++lineno=1;
return 0;
}
@@ -315,7 +377,7 @@ int do_source(struct query* q)
char* p, *name;
p = (char*)q->q + q->first_word_len;
while(*p && isspace(*p)) p++;
- if(!*p)
+ if (!*p)
die("Missing file name in source\n");
name = p;
while(*p && !isspace(*p))
@@ -329,9 +391,9 @@ int do_source(struct query* q)
int eval_expr(VAR* v, char* p, char* p_end)
{
VAR* vp;
- if(*p == '$')
+ if (*p == '$')
{
- if((vp = var_get(p,p_end,0)))
+ if ((vp = var_get(p,p_end,0)))
{
memcpy(v, vp, sizeof(VAR));
return 0;
@@ -344,7 +406,7 @@ int eval_expr(VAR* v, char* p, char* p_end)
return 0;
}
- if(p_end)
+ if (p_end)
*p_end = 0;
die("Invalid expr: %s", p);
return 1;
@@ -381,14 +443,14 @@ int do_system(struct query* q)
p = (char*)q->q + q->first_word_len;
while(*p && isspace(*p)) p++;
eval_expr(&v, p, 0); /* NULL terminated */
- if(v.str_val_len > 1)
+ if (v.str_val_len > 1)
{
char expr_buf[512];
- if((uint)v.str_val_len > sizeof(expr_buf) - 1)
+ if ((uint)v.str_val_len > sizeof(expr_buf) - 1)
v.str_val_len = sizeof(expr_buf) - 1;
memcpy(expr_buf, v.str_val, v.str_val_len);
expr_buf[v.str_val_len] = 0;
- if(system(expr_buf) && q->abort_on_error)
+ if (system(expr_buf) && q->abort_on_error)
die("system command '%s' failed", expr_buf);
}
return 0;
@@ -401,7 +463,7 @@ int do_echo(struct query* q)
p = (char*)q->q + q->first_word_len;
while(*p && isspace(*p)) p++;
eval_expr(&v, p, 0); /* NULL terminated */
- if(v.str_val_len > 1)
+ if (v.str_val_len > 1)
{
fflush(stdout);
write(1, v.str_val, v.str_val_len - 1);
@@ -415,13 +477,13 @@ int do_let(struct query* q)
char* p, *var_name, *var_name_end, *var_val_start;
p = (char*)q->q + q->first_word_len;
while(*p && isspace(*p)) p++;
- if(!*p)
+ if (!*p)
die("Missing variable name in let\n");
var_name = p;
while(*p && (*p != '=' || isspace(*p)))
p++;
var_name_end = p;
- if(*p == '=') p++;
+ if (*p == '=') p++;
while(*p && isspace(*p))
p++;
var_val_start = p;
@@ -437,37 +499,48 @@ int do_sleep(struct query* q)
int dec_mul = 1000000;
p = (char*)q->q + q->first_word_len;
while(*p && isspace(*p)) p++;
- if(!*p)
- die("Missing agument in sleep\n");
+ if (!*p)
+ die("Missing argument in sleep\n");
arg = p;
t.tv_sec = atoi(arg);
t.tv_usec = 0;
while(*p && *p != '.' && !isspace(*p))
p++;
- if(*p == '.')
- {
- char c;
- char *p_end;
- p++;
- p_end = p + 6;
+ if (*p == '.')
+ {
+ char c;
+ char *p_end;
+ p++;
+ p_end = p + 6;
- for(;p <= p_end; ++p)
- {
- c = *p - '0';
- if(c < 10 && c >= 0)
- {
- t.tv_usec = t.tv_usec * 10 + c;
- dec_mul /= 10;
- }
- else
- break;
- }
+ for(;p <= p_end; ++p)
+ {
+ c = *p - '0';
+ if (c < 10 && c >= 0)
+ {
+ t.tv_usec = t.tv_usec * 10 + c;
+ dec_mul /= 10;
+ }
+ else
+ break;
}
+ }
*p = 0;
t.tv_usec *= dec_mul;
return select(0,0,0,0, &t);
}
+static void get_file_name(char *filename, struct query* q)
+{
+ char *p = (char*) q->q + q->first_word_len;
+ while(*p && isspace(*p)) p++;
+ strnmov(filename, p, FN_REFLEN);
+ /* Remove end space */
+ while (p > filename && isspace(p[-1]))
+ p--;
+ p[0]=0;
+}
+
int select_connection(struct query* q)
{
@@ -475,7 +548,7 @@ int select_connection(struct query* q)
struct connection *con;
p = (char*)q->q + q->first_word_len;
while(*p && isspace(*p)) p++;
- if(!*p)
+ if (!*p)
die("Missing connection name in connect\n");
name = p;
while(*p && !isspace(*p))
@@ -483,7 +556,7 @@ int select_connection(struct query* q)
*p = 0;
for(con = cons; con < next_con; con++)
- if(!strcmp(con->name, name))
+ if (!strcmp(con->name, name))
{
cur_con = con;
return 0;
@@ -499,7 +572,7 @@ int close_connection(struct query* q)
struct connection *con;
p = (char*)q->q + q->first_word_len;
while(*p && isspace(*p)) p++;
- if(!*p)
+ if (!*p)
die("Missing connection name in connect\n");
name = p;
while(*p && !isspace(*p))
@@ -507,7 +580,7 @@ int close_connection(struct query* q)
*p = 0;
for(con = cons; con < next_con; con++)
- if(!strcmp(con->name, name))
+ if (!strcmp(con->name, name))
{
mysql_close(&con->mysql);
return 0;
@@ -529,10 +602,10 @@ char* safe_get_param(char* str, char** arg, const char* msg)
*arg = str;
while(*str && *str != ',' && *str != ')')
{
- if(isspace(*str)) *str = 0;
+ if (isspace(*str)) *str = 0;
str++;
}
- if(!*str)
+ if (!*str)
die(msg);
*str++ = 0;
@@ -548,7 +621,7 @@ int do_connect(struct query* q)
p = q->q + q->first_word_len;
while(*p && isspace(*p)) p++;
- if(*p != '(')
+ if (*p != '(')
die("Syntax error in connect - expeected '(' found '%c'", *p);
p++;
p = safe_get_param(p, &con_name, "missing connection name");
@@ -558,17 +631,17 @@ int do_connect(struct query* q)
p = safe_get_param(p, &con_db, "missing connection db");
p = safe_get_param(p, &con_port_str, "missing connection port");
p = safe_get_param(p, &con_sock, "missing connection scoket");
- if(next_con == cons_end)
+ if (next_con == cons_end)
die("Connection limit exhausted - incread MAX_CONS in mysqltest.c");
- if(!mysql_init(&next_con->mysql))
+ if (!mysql_init(&next_con->mysql))
die("Failed on mysql_init()");
- if(!mysql_real_connect(&next_con->mysql, con_host, con_user, con_pass,
+ if (!mysql_real_connect(&next_con->mysql, con_host, con_user, con_pass,
con_db, atoi(con_port_str), con_sock, 0))
die("Could not open connection '%s': %s", con_name,
mysql_error(&next_con->mysql));
- if(!(next_con->name = my_strdup(con_name, MYF(MY_WME))))
+ if (!(next_con->name = my_strdup(con_name, MYF(MY_WME))))
die("Out of memory");
cur_con = next_con++;
@@ -578,13 +651,13 @@ int do_connect(struct query* q)
int do_done(struct query* q)
{
q->type = Q_END_BLOCK;
- if(cur_block == block_stack)
+ if (cur_block == block_stack)
die("Stray '}' - end of block before beginning");
- if(block_ok)
+ if (block_ok)
parser.current_line = *--cur_block;
else
{
- if(!--false_block_depth)
+ if (!--false_block_depth)
block_ok = 1;
++parser.current_line;
}
@@ -596,22 +669,22 @@ int do_while(struct query* q)
char *p = q->q + q->first_word_len;
char* expr_start, *expr_end;
VAR v;
- if(cur_block == block_stack_end)
+ if (cur_block == block_stack_end)
die("Nesting too deep");
- if(!block_ok)
+ if (!block_ok)
{
++false_block_depth;
return 0;
}
expr_start = strchr(p, '(');
- if(!expr_start)
+ if (!expr_start)
die("missing '(' in while");
expr_end = strrchr(expr_start, ')');
- if(!expr_end)
+ if (!expr_end)
die("missing ')' in while");
eval_expr(&v, ++expr_start, --expr_end);
*cur_block++ = parser.current_line++;
- if(!v.int_val)
+ if (!v.int_val)
{
block_ok = 0;
false_block_depth = 1;
@@ -619,14 +692,6 @@ int do_while(struct query* q)
return 0;
}
-void close_cons()
-{
- for(--next_con; next_con >= cons; --next_con)
- {
- mysql_close(&next_con->mysql);
- my_free(next_con->name, MYF(MY_ALLOW_ZERO_PTR));
- }
-}
int safe_copy_unescape(char* dest, char* src, int size)
{
@@ -642,7 +707,7 @@ int safe_copy_unescape(char* dest, char* src, int size)
switch(state)
{
case ST_NORMAL:
- if(c == '\\')
+ if (c == '\\')
{
state = ST_ESCAPED;
}
@@ -650,7 +715,7 @@ int safe_copy_unescape(char* dest, char* src, int size)
*p_dest++ = c;
break;
case ST_ESCAPED:
- if((val = hex_val(c)) > 0)
+ if ((val = hex_val(c)) > 0)
{
*p_dest = val;
state = ST_HEX2;
@@ -662,7 +727,7 @@ int safe_copy_unescape(char* dest, char* src, int size)
}
break;
case ST_HEX2:
- if((val = hex_val(c)) > 0)
+ if ((val = hex_val(c)) > 0)
{
*p_dest = (*p_dest << 4) + val;
p_dest++;
@@ -683,179 +748,204 @@ int safe_copy_unescape(char* dest, char* src, int size)
int read_line(char* buf, int size)
{
int c;
- char* p = buf, *buf_end = buf + size;
+ char* p = buf, *buf_end = buf + size-1;
int no_save = 0;
enum {R_NORMAL, R_Q1, R_ESC_Q_Q1, R_ESC_Q_Q2,
R_ESC_SLASH_Q1, R_ESC_SLASH_Q2,
R_Q2, R_COMMENT, R_LINE_START} state = R_LINE_START;
- for(; p < buf_end ;)
+ start_lineno= *lineno;
+ for (; p < buf_end ;)
+ {
+ no_save = 0;
+ c = fgetc(*cur_file);
+ if (feof(*cur_file))
{
- no_save = 0;
- c = fgetc(*cur_file);
- if(feof(*cur_file))
- {
- fclose(*cur_file);
+ my_fclose(*cur_file,MYF(0));
- if(cur_file == file_stack)
- return 1;
- else
- {
- cur_file--;
- continue;
- }
- }
-
- switch(state)
- {
- case R_NORMAL:
- if(c == ';' || c == '{') /* '{' allows some interesting syntax
- * but we don't care, as long as the
- * correct sytnax gets parsed right */
- {
- *p = 0;
- return 0;
- }
- else if(c == '\'')
- state = R_Q1;
- else if(c == '"')
- state = R_Q2;
- else if(c == '\n')
- state = R_LINE_START;
-
- break;
- case R_COMMENT:
- no_save = 1;
- if(c == '\n')
- state = R_LINE_START;
- break;
-
- case R_LINE_START:
- if(c == '#')
- {
- state = R_COMMENT;
- no_save = 1;
- }
- else if(isspace(c))
- no_save = 1;
- else if(c == '}')
- {
- *buf++ = '}';
- *buf = 0;
- return 0;
- }
- else if(c == ';' || c == '{')
- {
- *p = 0;
- return 0;
- }
- else
- state = R_NORMAL;
- break;
+ if (cur_file == file_stack)
+ return 1;
+ else
+ {
+ cur_file--;
+ lineno--;
+ continue;
+ }
+ }
- case R_Q1:
- if(c == '\'')
- state = R_ESC_Q_Q1;
- else if(c == '\\')
- state = R_ESC_SLASH_Q1;
- break;
- case R_ESC_Q_Q1:
- if(c == ';')
- {
- *p = 0;
- return 0;
- }
- if(c != '\'')
- state = R_NORMAL;
- break;
- case R_ESC_SLASH_Q1:
- state = R_Q1;
- break;
+ switch(state) {
+ case R_NORMAL:
+ /* Only accept '{' in the beginning of a line */
+ if (c == ';')
+ {
+ *p = 0;
+ return 0;
+ }
+ else if (c == '\'')
+ state = R_Q1;
+ else if (c == '"')
+ state = R_Q2;
+ else if (c == '\n')
+ {
+ state = R_LINE_START;
+ (*lineno)++;
+ }
+ break;
+ case R_COMMENT:
+ if (c == '\n')
+ {
+ *p=0;
+ (*lineno)++;
+ return 0;
+ }
+ break;
+ case R_LINE_START:
+ if (c == '#' || c == '-')
+ {
+ state = R_COMMENT;
+ }
+ else if (isspace(c))
+ {
+ if (c == '\n')
+ start_lineno= ++*lineno; /* Query hasn't started yet */
+ no_save = 1;
+ }
+ else if (c == '}')
+ {
+ *buf++ = '}';
+ *buf = 0;
+ return 0;
+ }
+ else if (c == ';' || c == '{')
+ {
+ *p = 0;
+ return 0;
+ }
+ else
+ state = R_NORMAL;
+ break;
- case R_Q2:
- if(c == '"')
- state = R_ESC_Q_Q2;
- else if(c == '\\')
- state = R_ESC_SLASH_Q2;
- break;
- case R_ESC_Q_Q2:
- if(c == ';')
- {
- *p = 0;
- return 0;
- }
- if(c != '"')
- state = R_NORMAL;
- break;
- case R_ESC_SLASH_Q2:
- state = R_Q2;
- break;
- }
+ case R_Q1:
+ if (c == '\'')
+ state = R_ESC_Q_Q1;
+ else if (c == '\\')
+ state = R_ESC_SLASH_Q1;
+ break;
+ case R_ESC_Q_Q1:
+ if (c == ';')
+ {
+ *p = 0;
+ return 0;
+ }
+ if (c != '\'')
+ state = R_NORMAL;
+ else
+ state = R_Q1;
+ break;
+ case R_ESC_SLASH_Q1:
+ state = R_Q1;
+ break;
- if(!no_save)
- *p++ = c;
+ case R_Q2:
+ if (c == '"')
+ state = R_ESC_Q_Q2;
+ else if (c == '\\')
+ state = R_ESC_SLASH_Q2;
+ break;
+ case R_ESC_Q_Q2:
+ if (c == ';')
+ {
+ *p = 0;
+ return 0;
+ }
+ if (c != '"')
+ state = R_NORMAL;
+ else
+ state = R_Q2;
+ break;
+ case R_ESC_SLASH_Q2:
+ state = R_Q2;
+ break;
}
+
+ if (!no_save)
+ *p++ = c;
+ }
+ *p=0; /* Always end with \0 */
return feof(*cur_file);
}
+static char read_query_buf[MAX_QUERY];
+
int read_query(struct query** q_ptr)
{
- char buf[MAX_QUERY];
- char* p = buf,* p1 ;
+ char* p = read_query_buf, * p1 ;
int c, expected_errno;
struct query* q;
- if(parser.current_line < parser.read_lines)
- {
- get_dynamic(&q_lines, (gptr)q_ptr, parser.current_line) ;
- return 0;
- }
- if(!(*q_ptr=q=(struct query*)my_malloc(sizeof(*q), MYF(MY_WME)))
+
+ if (parser.current_line < parser.read_lines)
+ {
+ get_dynamic(&q_lines, (gptr)q_ptr, parser.current_line) ;
+ return 0;
+ }
+ if (!(*q_ptr=q=(struct query*)my_malloc(sizeof(*q), MYF(MY_WME)))
|| insert_dynamic(&q_lines, (gptr)&q)
)
die("Out of memory");
q->record_file[0] = 0;
+ q->require_file=0;
q->abort_on_error = 1;
- q->has_result_set = 0;
q->first_word_len = 0;
q->expected_errno = 0;
q->type = Q_UNKNOWN;
- if(read_line(buf, sizeof(buf)))
+ if (read_line(read_query_buf, sizeof(read_query_buf)))
return 1;
- if(*p == '!')
+
+ if (*p == '#')
+ {
+ q->type = Q_COMMENT;
+ }
+ else if (p[0] == '-' && p[1] == '-')
+ {
+ q->type = Q_COMMENT_WITH_COMMAND;
+ p+=2; /* To calculate first word */
+ }
+ else
+ {
+ if (*p == '!')
{
- q->abort_on_error = 0;
- p++;
- if(*p == '$')
- {
- expected_errno = 0;
- p++;
- for(;isdigit(*p);p++)
- expected_errno = expected_errno * 10 + *p - '0';
- q->expected_errno = expected_errno;
- }
+ q->abort_on_error = 0;
+ p++;
+ if (*p == '$')
+ {
+ expected_errno = 0;
+ p++;
+ for (;isdigit(*p);p++)
+ expected_errno = expected_errno * 10 + *p - '0';
+ q->expected_errno = expected_errno;
+ }
}
- while(*p && isspace(*p)) p++ ;
- if(*p == '@')
+ while(*p && isspace(*p)) p++ ;
+ if (*p == '@')
{
- q->has_result_set = 1;
p++;
p1 = q->record_file;
while(!isspace(c = *p) &&
p1 < q->record_file + sizeof(q->record_file) - 1)
*p1++ = *p++;
*p1 = 0;
-
}
-
+ }
while(*p && isspace(*p)) p++;
+ /* Calculate first word */
p1 = q->q;
while(*p && !isspace(*p))
*p1++ = *p++;
q->first_word_len = p1 - q->q;
- strcpy(p1, p);
+ strmov(p1, p);
parser.read_lines++;
return 0;
}
@@ -878,31 +968,6 @@ struct option long_options[] =
{0, 0,0,0}
};
-void die(const char* fmt, ...)
-{
- va_list args;
- va_start(args, fmt);
- fprintf(stderr, "%s: ", my_progname);
- vfprintf(stderr, fmt, args);
- fprintf(stderr, "\n");
- va_end(args);
- close_cons();
- exit(1);
-}
-
-void verbose_msg(const char* fmt, ...)
-{
- va_list args;
-
- if(!verbose) return;
-
- va_start(args, fmt);
-
- fprintf(stderr, "%s: ", my_progname);
- vfprintf(stderr, fmt, args);
- fprintf(stderr, "\n");
- va_end(args);
-}
static void print_version(void)
{
@@ -913,7 +978,7 @@ static void print_version(void)
void usage()
{
print_version();
- printf("MySQL AB, by Sasha & Matt\n");
+ printf("MySQL AB, by Sasha, Matt & Monty\n");
printf("This software comes with ABSOLUTELY NO WARRANTY\n\n");
printf("Runs a test against the mysql server and compares output with a results file.\n\n");
printf("Usage: %s [OPTIONS] [database] < test_file\n", my_progname);
@@ -927,10 +992,11 @@ void usage()
-P, --port=... Port number to use for connection.\n\
-S, --socket=... Socket file to use for connection.\n\
-r, --record Record output of test_file into result file.\n\
- -R, --result-file=... Store result in this file\n\
+ -R, --result-file=... Read/Store result from/in this file.\n\
-v, --verbose Write more.\n\
-q, --quiet, --silent Suppress all normal output.\n\
- -V, --version Output version information and exit.\n\n");
+ -V, --version Output version information and exit.\n\
+ --no-defaults Don't read default options from any options file.\n\n");
}
int parse_args(int argc, char **argv)
@@ -939,6 +1005,7 @@ int parse_args(int argc, char **argv)
my_bool tty_password=0;
load_defaults("my",load_default_groups,&argc,&argv);
+
while((c = getopt_long(argc, argv, "h:p::u:P:D:S:R:?rvVq",
long_options, &option_index)) != EOF)
{
@@ -949,7 +1016,6 @@ int parse_args(int argc, char **argv)
break;
case 'r':
record = 1;
- record_mode = "w";
break;
case 'u':
user = optarg;
@@ -957,7 +1023,7 @@ int parse_args(int argc, char **argv)
case 'R':
result_file = optarg;
break;
- case 'p':
+ case 'p':
if (optarg)
{
my_free(pass,MYF(MY_ALLOW_ZERO_PTR));
@@ -990,7 +1056,7 @@ int parse_args(int argc, char **argv)
exit(0);
default:
usage();
- exit(0);
+ exit(1);
}
}
@@ -1002,10 +1068,7 @@ int parse_args(int argc, char **argv)
exit(1);
}
if (argc == 1)
- {
- my_free(db,MYF(MY_ALLOW_ZERO_PTR));
- db=my_strdup(*argv,MYF(MY_WME));
- }
+ db= *argv;
if (tty_password)
pass=get_tty_password(NullS);
@@ -1024,9 +1087,10 @@ char* safe_str_append(char* buf, const char* str, int size)
void str_to_file(const char* fname, char* str, int size)
{
int fd;
- if((fd = my_open(fname, O_WRONLY|O_CREAT, MYF(MY_WME | MY_FFNF))) < 0)
+ if ((fd = my_open(fname, O_WRONLY | O_CREAT | O_TRUNC,
+ MYF(MY_WME | MY_FFNF))) < 0)
die("Could not open %s: errno = %d", fname, errno);
- if(my_write(fd, (byte*)str, size, MYF(MY_WME|MY_FNABP)))
+ if (my_write(fd, (byte*)str, size, MYF(MY_WME|MY_FNABP)))
die("write failed");
my_close(fd, MYF(0));
}
@@ -1034,14 +1098,10 @@ void str_to_file(const char* fname, char* str, int size)
void reject_dump(const char* record_file, char* buf, int size)
{
char reject_file[FN_REFLEN];
- char* p;
-
- if (strlen(record_file) >= FN_REFLEN-8)
- die("too long path name for reject");
- strmov(strmov(reject_file, record_file),".reject");
- str_to_file(reject_file, buf, size);
+ str_to_file(fn_format(reject_file, record_file,"",".reject",2), buf, size);
}
+
int run_query(MYSQL* mysql, struct query* q)
{
MYSQL_RES* res = 0;
@@ -1055,66 +1115,73 @@ int run_query(MYSQL* mysql, struct query* q)
DYN_STRING ds_tmp;
dyn_string_init(&ds_tmp);
- if( q->record_file[0])
- {
- ds = &ds_tmp;
- }
-
-
+ if ( q->record_file[0])
+ {
+ ds = &ds_tmp;
+ }
- if(mysql_query(mysql, q->q))
+ if (mysql_query(mysql, q->q))
+ {
+ if (q->require_file)
+ abort_not_supported_test();
+ if (q->abort_on_error)
+ die("At line %u: query '%s' failed: %d: %s", start_lineno, q->q,
+ mysql_errno(mysql), mysql_error(mysql));
+ else
{
- if(q->abort_on_error)
- die("query '%s' failed: %s", q->q, mysql_error(mysql));
- else
- {
- if(q->expected_errno)
- {
- error = (q->expected_errno != mysql_errno(mysql));
- if(error)
- verbose_msg("query '%s' failed with wrong errno\
+ if (q->expected_errno)
+ {
+ error = (q->expected_errno != mysql_errno(mysql));
+ if (error)
+ verbose_msg("query '%s' failed with wrong errno\
%d instead of %d", q->q, mysql_errno(mysql), q->expected_errno);
- goto end;
- }
-
- verbose_msg("query '%s' failed: %s", q->q, mysql_error(mysql));
- /* if we do not abort on error, failure to run the query does
- not fail the whole test case
- */
- goto end;
- }
- }
+ goto end;
+ }
- if(q->expected_errno)
- {
- error = 1;
- verbose_msg("query '%s' succeeded - should have failed with errno %d",
- q->q, q->expected_errno);
+ verbose_msg("query '%s' failed: %d: %s", q->q, mysql_errno(mysql),
+ mysql_error(mysql));
+ /* if we do not abort on error, failure to run the query does
+ not fail the whole test case
+ */
goto end;
}
+ }
+
+ if (q->expected_errno)
+ {
+ error = 1;
+ verbose_msg("query '%s' succeeded - should have failed with errno %d",
+ q->q, q->expected_errno);
+ goto end;
+ }
- if(!(res = mysql_store_result(mysql)) && mysql_field_count(mysql))
+ if (!(res = mysql_store_result(mysql)) && mysql_field_count(mysql))
+ {
+ if (q->require_file)
+ abort_not_supported_test();
+ if (q->abort_on_error)
+ die("At line %u: Failed in mysql_store_result for query '%s' (%d)",
+ start_lineno, q->q, mysql_errno(mysql));
+ else
{
- if(q->abort_on_error)
- die("failed in mysql_store_result for query '%s'", q->q);
- else
- {
- verbose_msg("failed in mysql_store_result for query '%s'", q->q);
- error = 1;
- goto end;
- }
+ verbose_msg("failed in mysql_store_result for query '%s' (%d)", q->q,
+ mysql_errno(mysql));
+ error = 1;
+ goto end;
}
+ }
- if(!res) goto end;
+ if (!res) goto end;
fields = mysql_fetch_fields(res);
- num_fields = mysql_num_fields(res);
+ num_fields = mysql_num_fields(res);
for( i = 0; i < num_fields; i++)
- {
- dyn_string_append(ds, fields[i].name, 0);
+ {
+ if (i)
dyn_string_append(ds, "\t", 1);
- }
+ dyn_string_append(ds, fields[i].name, 0);
+ }
dyn_string_append(ds, "\n", 1);
@@ -1123,111 +1190,71 @@ int run_query(MYSQL* mysql, struct query* q)
{
lengths = mysql_fetch_lengths(res);
for(i = 0; i < num_fields; i++)
- {
- val = (char*)row[i];
- len = lengths[i];
+ {
+ val = (char*)row[i];
+ len = lengths[i];
- if(!val)
- {
- val = (char*)"NULL";
- len = 4;
- }
+ if (!val)
+ {
+ val = (char*)"NULL";
+ len = 4;
+ }
- dyn_string_append(ds, val, len);
+ if (i)
dyn_string_append(ds, "\t", 1);
- }
+ dyn_string_append(ds, val, len);
+ }
dyn_string_append(ds, "\n", 1);
}
- if(record)
- {
- if(!q->record_file[0] && !result_file)
- die("Missing result file");
- if(!result_file)
- str_to_file(q->record_file, ds->str, ds->len);
- }
- else if(q->record_file[0])
- {
- error = check_result(ds, q->record_file);
- }
+ if (record)
+ {
+ if (!q->record_file[0] && !result_file)
+ die("At line %u: Missing result file", start_lineno);
+ if (!result_file)
+ str_to_file(q->record_file, ds->str, ds->len);
+ }
+ else if (q->record_file[0])
+ {
+ error = check_result(ds, q->record_file, q->require_file);
+ }
- end:
- if(res) mysql_free_result(res);
+end:
+ if (res) mysql_free_result(res);
return error;
}
-int check_first_word(struct query* q, const char* word, int len)
-{
- const char* p, *p1, *end;
-
- if(len != q->first_word_len)
- return 0;
-
-
- p = word;
- end = p + len;
- p1 = q->q;
-
- for(; p < end; p++, p1++)
- if(tolower(*p) != tolower(*p1))
- return 0;
-
- return 1;
-}
void get_query_type(struct query* q)
{
- if(*q->q == '}')
- {
- q->type = Q_END_BLOCK;
- return;
- }
- q->type = Q_QUERY;
- switch(q->first_word_len)
- {
- case 3:
- if(check_first_word(q, "inc", 3))
- q->type = Q_INC;
- else if(check_first_word(q, "dec", 3))
- q->type = Q_DEC;
- else if(check_first_word(q, "let", 3))
- q->type = Q_LET;
- break;
- case 4:
- if(check_first_word(q, "echo", 4))
- q->type = Q_ECHO;
- break;
- case 5:
- if(check_first_word(q, "sleep", 5))
- q->type = Q_SLEEP;
- else if(check_first_word(q, "while", 5))
- q->type = Q_WHILE;
- break;
- case 6:
- if(check_first_word(q, "source", 6))
- q->type = Q_SOURCE;
- else if(check_first_word(q, "system", 6))
- q->type = Q_SYSTEM;
- break;
- case 7:
- if(check_first_word(q, "connect", 7))
- q->type = Q_CONNECT;
- break;
- case 10:
- if(check_first_word(q, "connection", 10))
- q->type = Q_CONNECTION;
- else if(check_first_word(q, "disconnect", 10))
- q->type = Q_DISCONNECT;
- break;
-
- }
+ char save;
+ uint type;
+ if (*q->q == '}')
+ {
+ q->type = Q_END_BLOCK;
+ return;
+ }
+ if (q->type != Q_COMMENT_WITH_COMMAND)
+ q->type = Q_QUERY;
+
+ save=q->q[q->first_word_len];
+ q->q[q->first_word_len]=0;
+ type=find_type(q->q, &command_typelib, 0);
+ q->q[q->first_word_len]=save;
+ if (type > 0)
+ q->type=type; /* Found command */
}
+
+
int main(int argc, char** argv)
{
int error = 0;
struct query* q;
+ my_bool require_file=0;
+ char save_file[FN_REFLEN];
+ save_file[0]=0;
MY_INIT(argv[0]);
memset(cons, 0, sizeof(cons));
@@ -1238,6 +1265,7 @@ int main(int argc, char** argv)
memset(file_stack, 0, sizeof(file_stack));
file_stack_end = file_stack + MAX_INCLUDE_DEPTH;
cur_file = file_stack;
+ lineno = lineno_stack;
init_dynamic_array(&q_lines, sizeof(struct query*), INIT_Q_LINES,
INIT_Q_LINES);
memset(block_stack, 0, sizeof(block_stack));
@@ -1245,73 +1273,87 @@ int main(int argc, char** argv)
cur_block = block_stack;
dyn_string_init(&ds_res);
parse_args(argc, argv);
- if(!*cur_file)
+ if (!*cur_file)
*cur_file = stdin;
+ *lineno=1;
-
-
- if(!( mysql_init(&cur_con->mysql)))
+ if (!( mysql_init(&cur_con->mysql)))
die("Failed in mysql_init()");
-
- mysql_options(&cur_con->mysql, MYSQL_READ_DEFAULT_GROUP, "mysql");
-
cur_con->name = my_strdup("default", MYF(MY_WME));
- if(!cur_con->name)
+ if (!cur_con->name)
die("Out of memory");
- if(!mysql_real_connect(&cur_con->mysql, host,
+ if (!mysql_real_connect(&cur_con->mysql, host,
user, pass, db, port, unix_sock,
0))
die("Failed in mysql_real_connect(): %s", mysql_error(&cur_con->mysql));
for(;!read_query(&q);)
+ {
+ int current_line_inc = 1, processed = 0;
+ if (q->type == Q_UNKNOWN || q->type == Q_COMMENT_WITH_COMMAND)
+ get_query_type(q);
+ if (block_ok)
{
- int current_line_inc = 1, processed = 0;
- if(q->type == Q_UNKNOWN)
- get_query_type(q);
- if(block_ok)
- {
- processed = 1;
- switch(q->type)
- {
- case Q_CONNECT: do_connect(q); break;
- case Q_CONNECTION: select_connection(q); break;
- case Q_DISCONNECT: close_connection(q); break;
- case Q_SOURCE: do_source(q); break;
- case Q_SLEEP: do_sleep(q); break;
- case Q_INC: do_inc(q); break;
- case Q_DEC: do_dec(q); break;
- case Q_ECHO: do_echo(q); break;
- case Q_SYSTEM: do_system(q); break;
- case Q_LET: do_let(q); break;
- case Q_QUERY: error |= run_query(&cur_con->mysql, q); break;
- default: processed = 0; break;
- }
- }
-
- if(!processed)
+ processed = 1;
+ switch (q->type) {
+ case Q_CONNECT: do_connect(q); break;
+ case Q_CONNECTION: select_connection(q); break;
+ case Q_DISCONNECT: close_connection(q); break;
+ case Q_SOURCE: do_source(q); break;
+ case Q_SLEEP: do_sleep(q); break;
+ case Q_INC: do_inc(q); break;
+ case Q_DEC: do_dec(q); break;
+ case Q_ECHO: do_echo(q); break;
+ case Q_SYSTEM: do_system(q); break;
+ case Q_LET: do_let(q); break;
+ case Q_QUERY:
+ {
+ if (save_file[0])
{
- current_line_inc = 0;
- switch(q->type)
- {
- case Q_WHILE: do_while(q); break;
- case Q_END_BLOCK: do_done(q); break;
- default: current_line_inc = 1; break;
- }
+ strmov(q->record_file,save_file);
+ q->require_file=require_file;
+ save_file[0]=0;
}
+ error |= run_query(&cur_con->mysql, q); break;
+ }
+ case Q_RESULT:
+ get_file_name(save_file,q);
+ require_file=0;
+ break;
+ case Q_REQUIRE:
+ get_file_name(save_file,q);
+ require_file=1;
+ break;
+ case Q_COMMENT: /* Ignore row */
+ case Q_COMMENT_WITH_COMMAND:
+ default: processed = 0; break;
+ }
+ }
- parser.current_line += current_line_inc;
+ if (!processed)
+ {
+ current_line_inc = 0;
+ switch(q->type)
+ {
+ case Q_WHILE: do_while(q); break;
+ case Q_END_BLOCK: do_done(q); break;
+ default: current_line_inc = 1; break;
+ }
}
+ parser.current_line += current_line_inc;
+ }
+
close_cons();
- if(result_file && ds_res.len)
- {
- if(!record)
- error |= check_result(&ds_res, result_file);
- else
- str_to_file(result_file, ds_res.str, ds_res.len);
- }
+ if (result_file && ds_res.len)
+ {
+ if(!record)
+ error |= check_result(&ds_res, result_file, q->require_file);
+ else
+ str_to_file(result_file, ds_res.str, ds_res.len);
+ }
dyn_string_end(&ds_res);
if (!silent) {
diff --git a/client/readline.cc b/client/readline.cc
index c14059d98c8..f0312b089e5 100644
--- a/client/readline.cc
+++ b/client/readline.cc
@@ -26,7 +26,7 @@ static bool init_line_buffer(LINE_BUFFER *buffer,File file,ulong size,
ulong max_size);
static bool init_line_buffer_from_string(LINE_BUFFER *buffer,my_string str);
static uint fill_buffer(LINE_BUFFER *buffer);
-static char *intern_read_line(LINE_BUFFER *buffer,uint *out_length);
+static char *intern_read_line(LINE_BUFFER *buffer,ulong *out_length);
LINE_BUFFER *batch_readline_init(ulong max_size,FILE *file)
@@ -46,12 +46,13 @@ LINE_BUFFER *batch_readline_init(ulong max_size,FILE *file)
char *batch_readline(LINE_BUFFER *line_buff)
{
char *pos;
- uint out_length;
+ ulong out_length;
if (!(pos=intern_read_line(line_buff,&out_length)))
return 0;
if (out_length && pos[out_length-1] == '\n')
out_length--; /* Remove '\n' */
+ line_buff->read_length=out_length;
pos[out_length]=0;
return pos;
}
@@ -187,7 +188,7 @@ static uint fill_buffer(LINE_BUFFER *buffer)
-char *intern_read_line(LINE_BUFFER *buffer,uint *out_length)
+char *intern_read_line(LINE_BUFFER *buffer,ulong *out_length)
{
char *pos;
uint length;
@@ -210,7 +211,7 @@ char *intern_read_line(LINE_BUFFER *buffer,uint *out_length)
pos--; /* break line here */
}
buffer->end_of_line=pos+1;
- *out_length=(uint) (pos + 1 - buffer->eof - buffer->start_of_line);
+ *out_length=(ulong) (pos + 1 - buffer->eof - buffer->start_of_line);
DBUG_RETURN(buffer->start_of_line);
}
}
diff --git a/configure.in b/configure.in
index db2c93891eb..bb39772af1b 100644
--- a/configure.in
+++ b/configure.in
@@ -4,7 +4,7 @@ dnl Process this file with autoconf to produce a configure script.
AC_INIT(sql/mysqld.cc)
AC_CANONICAL_SYSTEM
# The Docs Makefile.am parses this line!
-AM_INIT_AUTOMAKE(mysql, 3.23.29a-gamma)
+AM_INIT_AUTOMAKE(mysql, 3.23.30-gamma)
AM_CONFIG_HEADER(config.h)
PROTOCOL_VERSION=10
@@ -436,10 +436,16 @@ AM_CONDITIONAL(ASSEMBLER, test ASSEMBLER_x86 = "" -o ASSEMBLER_x86 = "")
AC_MSG_CHECKING(whether to use RAID)
AC_ARG_WITH(raid,
[ --with-raid Enable RAID Support],
- [ AC_DEFINE(USE_RAID)
- AC_MSG_RESULT(yes) ],
- [ AC_MSG_RESULT(no) ]
+ [ USE_RAID=$withval ],
+ [ USE_RAID=no ]
)
+if test "$USE_RAID" = "yes"
+then
+ AC_MSG_RESULT([yes])
+ AC_DEFINE([USE_RAID])
+else
+ AC_MSG_RESULT([no])
+fi
# Use this to set the place used for unix socket used to local communication.
AC_ARG_WITH(unix-socket-path,
diff --git a/heap/_check.c b/heap/_check.c
index 77fa0262732..e22eb5e7e4a 100644
--- a/heap/_check.c
+++ b/heap/_check.c
@@ -18,11 +18,12 @@
#include "heapdef.h"
-static int check_one_key(HP_KEYDEF *keydef,ulong records,ulong blength);
+static int check_one_key(HP_KEYDEF *keydef, uint keynr, ulong records,
+ ulong blength, my_bool print_status);
/* Returns 0 if the HEAP is ok */
-int heap_check_heap(HP_INFO *info)
+int heap_check_heap(HP_INFO *info,my_bool print_status)
{
int error;
uint key;
@@ -30,13 +31,15 @@ int heap_check_heap(HP_INFO *info)
DBUG_ENTER("heap_check_keys");
for (error=key=0 ; key < share->keys ; key++)
- error|=check_one_key(share->keydef+key,share->records,share->blength);
+ error|=check_one_key(share->keydef+key,key, share->records,share->blength,
+ print_status);
DBUG_RETURN(error);
}
-static int check_one_key(HP_KEYDEF *keydef, ulong records, ulong blength)
+static int check_one_key(HP_KEYDEF *keydef, uint keynr, ulong records,
+ ulong blength, my_bool print_status)
{
int error;
uint i,found,max_links,seek,links;
@@ -76,6 +79,9 @@ static int check_one_key(HP_KEYDEF *keydef, ulong records, ulong blength)
}
DBUG_PRINT("info",
("records: %ld seeks: %d max links: %d hitrate: %.2f",
- records,seek,max_links,(float) seek / (float) records));
+ records,seek,max_links,(float) seek / (float) (records ? records : 1)));
+ if (print_status)
+ printf("Key: %d records: %ld seeks: %d max links: %d hitrate: %.2f\n",
+ keynr, records, seek, max_links, (float) seek / (float) records);
return error;
}
diff --git a/heap/hp_close.c b/heap/hp_close.c
index b1797d2e92f..583602e98cb 100644
--- a/heap/hp_close.c
+++ b/heap/hp_close.c
@@ -37,7 +37,7 @@ int _hp_close(register HP_INFO *info)
int error=0;
DBUG_ENTER("_hp_close");
#ifndef DBUG_OFF
- if (info->s->changed && heap_check_heap(info))
+ if (info->s->changed && heap_check_heap(info,0))
{
error=my_errno=HA_ERR_CRASHED;
}
diff --git a/heap/hp_hash.c b/heap/hp_hash.c
index 28647ab7c94..eb35b947871 100644
--- a/heap/hp_hash.c
+++ b/heap/hp_hash.c
@@ -145,6 +145,7 @@ void _hp_movelink(HASH_INFO *pos, HASH_INFO *next_link, HASH_INFO *newlink)
return;
}
+#ifndef NEW_HASH_FUNCTION
/* Calc hashvalue for a key */
@@ -152,13 +153,14 @@ ulong _hp_hashnr(register HP_KEYDEF *keydef, register const byte *key)
{
register ulong nr=1, nr2=4;
HP_KEYSEG *seg,*endseg;
- uchar *pos;
for (seg=keydef->seg,endseg=seg+keydef->keysegs ; seg < endseg ; seg++)
{
+ uchar *pos=(uchar*) key;
+ key+=seg->length;
if (seg->type == HA_KEYTYPE_TEXT)
{
- for (pos=(uchar*) key,key+=seg->length ; pos < (uchar*) key ; pos++)
+ for (; pos < (uchar*) key ; pos++)
{
nr^=(ulong) ((((uint) nr & 63)+nr2)*((uint) my_sort_order[(uint) *pos]))+ (nr << 8);
nr2+=3;
@@ -166,7 +168,7 @@ ulong _hp_hashnr(register HP_KEYDEF *keydef, register const byte *key)
}
else
{
- for (pos=(uchar*) key,key+=seg->length ; pos < (uchar*) key ; pos++)
+ for (; pos < (uchar*) key ; pos++)
{
nr^=(ulong) ((((uint) nr & 63)+nr2)*((uint) *pos))+ (nr << 8);
nr2+=3;
@@ -182,13 +184,13 @@ ulong _hp_rec_hashnr(register HP_KEYDEF *keydef, register const byte *rec)
{
register ulong nr=1, nr2=4;
HP_KEYSEG *seg,*endseg;
- uchar *pos,*end;
for (seg=keydef->seg,endseg=seg+keydef->keysegs ; seg < endseg ; seg++)
{
+ uchar *pos=(uchar*) rec+seg->start,*end=pos+seg->length;
if (seg->type == HA_KEYTYPE_TEXT)
{
- for (pos=(uchar*) rec+seg->start,end=pos+seg->length ; pos < end ; pos++)
+ for (; pos < end ; pos++)
{
nr^=(ulong) ((((uint) nr & 63)+nr2)*((uint) my_sort_order[(uint) *pos]))+ (nr << 8);
nr2+=3;
@@ -196,7 +198,7 @@ ulong _hp_rec_hashnr(register HP_KEYDEF *keydef, register const byte *rec)
}
else
{
- for (pos=(uchar*) rec+seg->start,end=pos+seg->length ; pos < end ; pos++)
+ for (; pos < end ; pos++)
{
nr^=(ulong) ((((uint) nr & 63)+nr2)*((uint) *pos))+ (nr << 8);
nr2+=3;
@@ -206,6 +208,85 @@ ulong _hp_rec_hashnr(register HP_KEYDEF *keydef, register const byte *rec)
return((ulong) nr);
}
+#else
+
+/*
+ * Fowler/Noll/Vo hash
+ *
+ * The basis of the hash algorithm was taken from an idea sent by email to the
+ * IEEE Posix P1003.2 mailing list from Phong Vo (kpv@research.att.com) and
+ * Glenn Fowler (gsf@research.att.com). Landon Curt Noll (chongo@toad.com)
+ * later improved on their algorithm.
+ *
+ * The magic is in the interesting relationship between the special prime
+ * 16777619 (2^24 + 403) and 2^32 and 2^8.
+ *
+ * This hash produces the fewest collisions of any function that we've seen so
+ * far, and works well on both numbers and strings.
+ */
+
+ulong _hp_hashnr(register HP_KEYDEF *keydef, register const byte *key)
+{
+ register ulong nr=0;
+ HP_KEYSEG *seg,*endseg;
+
+ for (seg=keydef->seg,endseg=seg+keydef->keysegs ; seg < endseg ; seg++)
+ {
+ uchar *pos=(uchar*) key;
+ key+=seg->length;
+ if (seg->type == HA_KEYTYPE_TEXT)
+ {
+ for (; pos < (uchar*) key ; pos++)
+ {
+ nr *=16777619;
+ nr ^=((uint) my_sort_order[(uint) *pos]);
+ }
+ }
+ else
+ {
+ for ( ; pos < (uchar*) key ; pos++)
+ {
+ nr *=16777619;
+ nr ^=(uint) *pos;
+ }
+ }
+ }
+ return((ulong) nr);
+}
+
+ /* Calc hashvalue for a key in a record */
+
+ulong _hp_rec_hashnr(register HP_KEYDEF *keydef, register const byte *rec)
+{
+ register ulong nr=0;
+ HP_KEYSEG *seg,*endseg;
+
+ for (seg=keydef->seg,endseg=seg+keydef->keysegs ; seg < endseg ; seg++)
+ {
+ uchar *pos=(uchar*) rec+seg->start,*end=pos+seg->length;
+ if (seg->type == HA_KEYTYPE_TEXT)
+ {
+ for ( ; pos < end ; pos++)
+ {
+ nr *=16777619;
+ nr ^=(uint) my_sort_order[(uint) *pos];
+ }
+ }
+ else
+ {
+ for ( ; pos < end ; pos++)
+ {
+ nr *=16777619;
+ nr ^=(uint) *pos;
+ }
+ }
+ }
+ return((ulong) nr);
+}
+
+#endif
+
+
/* Compare keys for two records. Returns 0 if they are identical */
int _hp_rec_key_cmp(HP_KEYDEF *keydef, const byte *rec1, const byte *rec2)
diff --git a/heap/hp_open.c b/heap/hp_open.c
index 77de5ca824a..3040da50484 100644
--- a/heap/hp_open.c
+++ b/heap/hp_open.c
@@ -38,6 +38,7 @@ HP_INFO *heap_open(const char *name, int mode, uint keys, HP_KEYDEF *keydef,
pthread_mutex_lock(&THR_LOCK_heap);
if (!(share=_hp_find_named_heap(name)))
{
+ DBUG_PRINT("info",("Initializing new table"));
for (i=key_segs=max_length=0 ; i < keys ; i++)
{
key_segs+= keydef[i].keysegs;
diff --git a/heap/hp_test1.c b/heap/hp_test1.c
index 848157e831b..f44752af3bc 100644
--- a/heap/hp_test1.c
+++ b/heap/hp_test1.c
@@ -65,7 +65,7 @@ int main(int argc, char **argv)
sprintf(key,"%6d",j);
bmove(record+1,key,6);
error=heap_write(file,record);
- if (heap_check_heap(file))
+ if (heap_check_heap(file,0))
{
puts("Heap keys crashed");
goto err;
@@ -100,7 +100,7 @@ int main(int argc, char **argv)
if (! error)
deleted++;
}
- if (heap_check_heap(file))
+ if (heap_check_heap(file,0))
{
puts("Heap keys crashed");
goto err;
diff --git a/heap/hp_test2.c b/heap/hp_test2.c
index bfb30e59622..e3ed7a90df5 100644
--- a/heap/hp_test2.c
+++ b/heap/hp_test2.c
@@ -133,7 +133,7 @@ char *argv[];
write_count++; key1[n1]++; key3[n3]=1;
key_check+=n1;
}
- if (testflag == 1 && heap_check_heap(file))
+ if (testflag == 1 && heap_check_heap(file,0))
{
puts("Heap keys crashed");
goto err;
@@ -141,7 +141,7 @@ char *argv[];
}
if (testflag == 1)
goto end;
- if (heap_check_heap(file))
+ if (heap_check_heap(file,0))
{
puts("Heap keys crashed");
goto err;
@@ -173,7 +173,7 @@ char *argv[];
key1[atoi(record+keyinfo[0].seg[0].start)]--;
key3[atoi(record+keyinfo[2].seg[0].start)]=0;
key_check-=atoi(record);
- if (testflag == 2 && heap_check_heap(file))
+ if (testflag == 2 && heap_check_heap(file,0))
{
puts("Heap keys crashed");
goto err;
@@ -183,7 +183,7 @@ char *argv[];
puts("Warning: Skipping delete test because no dupplicate keys");
}
if (testflag==2) goto end;
- if (heap_check_heap(file))
+ if (heap_check_heap(file,0))
{
puts("Heap keys crashed");
goto err;
@@ -239,14 +239,14 @@ char *argv[];
update++;
key_check=key_check-atoi(record)+n1;
}
- if (testflag == 3 && heap_check_heap(file))
+ if (testflag == 3 && heap_check_heap(file,0))
{
puts("Heap keys crashed");
goto err;
}
}
if (testflag == 3) goto end;
- if (heap_check_heap(file))
+ if (heap_check_heap(file,0))
{
puts("Heap keys crashed");
goto err;
@@ -284,7 +284,7 @@ char *argv[];
goto end;
}
dupp_keys--;
- if (heap_check_heap(file))
+ if (heap_check_heap(file,0))
{
puts("Heap keys crashed");
goto err;
@@ -320,7 +320,7 @@ char *argv[];
goto end;
}
dupp_keys-=2;
- if (heap_check_heap(file))
+ if (heap_check_heap(file,0))
{
puts("Heap keys crashed");
goto err;
@@ -353,7 +353,7 @@ char *argv[];
printf("next: Found: %d records of %d\n",ant,write_count-delete);
goto end;
}
- if (heap_check_heap(file))
+ if (heap_check_heap(file,0))
{
puts("Heap keys crashed");
goto err;
@@ -556,7 +556,8 @@ char *argv[];
}
pos++;
}
- if (heap_check_heap(file) || heap_check_heap(file2))
+ printf("- Checking heap tables\n");
+ if (heap_check_heap(file,1) || heap_check_heap(file2,1))
{
puts("Heap keys crashed");
goto err;
diff --git a/include/heap.h b/include/heap.h
index 74b37b0c534..8cbb500fa86 100644
--- a/include/heap.h
+++ b/include/heap.h
@@ -156,7 +156,7 @@ extern int heap_rlast(HP_INFO *info,byte *record);
extern void heap_clear(HP_INFO *info);
extern int heap_rkey(HP_INFO *info,byte *record,int inx,const byte *key);
extern gptr heap_find(HP_INFO *info,int inx,const byte *key);
-extern int heap_check_heap(HP_INFO *info);
+extern int heap_check_heap(HP_INFO *info, my_bool print_status);
extern byte *heap_position(HP_INFO *info);
/* The following is for programs that uses the old HEAP interface where
diff --git a/merge/rrnd.c b/merge/rrnd.c
index 0abd72a3edd..e53982aca21 100644
--- a/merge/rrnd.c
+++ b/merge/rrnd.c
@@ -82,7 +82,7 @@ int mrg_rrnd(MRG_INFO *info,byte *buf,mrg_off_t filepos)
}
}
info->current_table=find_table(info->open_tables,
- info->end_table,filepos);
+ info->end_table-1,filepos);
isam_info=info->current_table->table;
isam_info->update&= HA_STATE_CHANGED;
return ((*isam_info->s->read_rnd)(isam_info,(byte*) buf,
diff --git a/myisam/myisamlog.c b/myisam/myisamlog.c
index 87f09f984f7..ca2c4f27a74 100644
--- a/myisam/myisamlog.c
+++ b/myisam/myisamlog.c
@@ -393,7 +393,7 @@ static int examine_log(my_string file_name, char **table_names)
char *pos,*to;
/* Fix if old DOS files to new format */
- for (pos=file_info.name; pos=strchr(pos,'\\') ; pos++)
+ for (pos=file_info.name; (pos=strchr(pos,'\\')) ; pos++)
*pos= '/';
pos=file_info.name;
diff --git a/mysql-test/include/have_bdb.inc b/mysql-test/include/have_bdb.inc
new file mode 100644
index 00000000000..0126e30210f
--- /dev/null
+++ b/mysql-test/include/have_bdb.inc
@@ -0,0 +1,2 @@
+-- require r/have_bdb.require
+show variables like "have_bdb";
diff --git a/mysql-test/include/have_isam.inc b/mysql-test/include/have_isam.inc
new file mode 100644
index 00000000000..d83328f70f4
--- /dev/null
+++ b/mysql-test/include/have_isam.inc
@@ -0,0 +1,2 @@
+-- require r/have_isam.require
+show variables like "have_isam";
diff --git a/mysql-test/install_test_db.sh b/mysql-test/install_test_db.sh
index be037b06538..28e6ad34419 100755
--- a/mysql-test/install_test_db.sh
+++ b/mysql-test/install_test_db.sh
@@ -17,16 +17,16 @@ else
fix_bin=.
fi
+vardir=var
+logdir=$vardir/log
if [ x$1 = x"-slave" ]
then
shift 1
data=var/slave-data
ldata=$fix_bin/var/slave-data
- logdir=var/log
else
data=var/lib
ldata=$fix_bin/var/lib
- logdir=var/log
fi
mdata=$data/mysql
@@ -45,9 +45,13 @@ hostname=`hostname` # Install this too in the user table
resolved=127.0.0.1
+#create the directories
+[ -d $vardir ] || mkdir $vardir
+[ -d $logdir ] || mkdir $logdir
+
# Create database directories mysql & test
if [ -d $data ] ; then rm -rf $data ; fi
-mkdir -p $data $data/mysql $data/test
+mkdir $data $data/mysql $data/test
#for error messages
if [ x$BINARY_DIST = x1 ] ; then
@@ -59,9 +63,6 @@ mkdir share
ln -sf ../../sql/share share/mysql
fi
-#create the directory for logs
-mkdir -p $logdir
-
# Initialize variables
c_d="" i_d=""
c_h="" i_h=""
diff --git a/mysql-test/mysql-test-run.sh b/mysql-test/mysql-test-run.sh
index bcc3e0259ec..8ff75be324a 100755
--- a/mysql-test/mysql-test-run.sh
+++ b/mysql-test/mysql-test-run.sh
@@ -2,6 +2,7 @@
# mysql-test-run - originally written by Matt Wagner <matt@mysql.com>
# modified by Sasha Pachev <sasha@mysql.com>
# Sligtly updated by Monty
+# Cleaned up again by Matt
#++
# Access Definitions
@@ -9,6 +10,7 @@
DB=test
DBUSER=test
DBPASSWD=
+VERBOSE=""
# Are we on source or binary distribution?
@@ -24,15 +26,12 @@ else
if [ -f ./mysql-test-run ] && [ -d ../sql ] ; then
SOURCE_DIST=1
else
- echo "If you are using binary distribution, run me from install root as"
- echo "scripts/mysql-test-run. On source distribution run me from source root"
- echo "as mysql-test/mysql-test-run or from mysql-test as ./mysql-test-run"
+ $ECHO "If you are using binary distribution, run from install root as"
+ $ECHO "scripts/mysql-test-run. On source distribution run from source root"
+ $ECHO "as mysql-test/mysql-test-run or from mysql-test as ./mysql-test-run"
exit 1
fi
-
fi
-
-
#++
# Misc. Definitions
@@ -55,35 +54,32 @@ TOT_TEST=0
USERT=0
SYST=0
REALT=0
-MY_TMP_DIR=$MYSQL_TEST_DIR/var/tmp
-TIMEFILE="$MYSQL_TEST_DIR/var/tmp/mysqltest-time"
+MYSQL_TMP_DIR=$MYSQL_TEST_DIR/var/tmp
+TIMEFILE="$MYSQL_TMP_DIR/mysqltest-time"
RES_SPACE=" "
MYSQLD_SRC_DIRS="strings mysys include extra regex isam merge myisam \
myisammrg heap sql"
-GCOV_MSG=/tmp/mysqld-gcov.out
-GCOV_ERR=/tmp/mysqld-gcov.err
+GCOV_MSG=$MYSQL_TMP_DIR/mysqld-gcov.out
+GCOV_ERR=$MYSQL_TMP_DIR/mysqld-gcov.err
MASTER_RUNNING=0
SLAVE_RUNNING=0
-[ -d $MY_TMP_DIR ] || mkdir -p $MY_TMP_DIR
-
#++
# mysqld Environment Parameters
#--
-MYRUN_DIR=var/run
+MYRUN_DIR=$MYSQL_TEST_DIR/var/run
MASTER_MYPORT=9306
MASTER_MYDDIR="$MYSQL_TEST_DIR/var/lib"
-MASTER_MYSOCK="$MYSQL_TEST_DIR/var/tmp/mysql.sock"
-MASTER_MYPID="$MYSQL_TEST_DIR/var/run/mysqld.pid"
+MASTER_MYSOCK="$MYSQL_TMP_DIR/mysql.sock"
+MASTER_MYPID="$MYRUN_DIR/mysqld.pid"
MASTER_MYLOG="$MYSQL_TEST_DIR/var/log/mysqld.log"
MASTER_MYERR="$MYSQL_TEST_DIR/var/log/mysqld.err"
-
SLAVE_MYPORT=9307
SLAVE_MYDDIR="$MYSQL_TEST_DIR/var/slave-data"
-SLAVE_MYSOCK="$MYSQL_TEST_DIR/var/tmp/mysql-slave.sock"
-SLAVE_MYPID="$MYSQL_TEST_DIR/var/run/mysqld-slave.pid"
+SLAVE_MYSOCK="$MYSQL_TMP_DIR/mysql-slave.sock"
+SLAVE_MYPID="$MYRUN_DIR/mysqld-slave.pid"
SLAVE_MYLOG="$MYSQL_TEST_DIR/var/log/mysqld-slave.log"
SLAVE_MYERR="$MYSQL_TEST_DIR/var/log/mysqld-slave.err"
@@ -93,6 +89,15 @@ else
MY_BASEDIR=$BASEDIR
fi
+# Create the directories
+
+# This should be fixed to be not be dependent on the contence of MYSQL_TMP_DIR
+# or MYRUN_DIR
+# (mkdir -p is not portable)
+[ -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
+
#++
# Program Definitions
#--
@@ -111,8 +116,8 @@ XARGS=`which xargs | head -1`
[ -z "$COLUMNS" ] && COLUMNS=80
E=`$EXPR $COLUMNS - 8`
-#DASH72=`expr substr '________________________________________________________________________' 1 $E`
-DASH72=`$ECHO '________________________________________________________________________'|$CUT -c 1-$E`
+#DASH72=`expr substr '------------------------------------------------------------------------' 1 $E`
+DASH72=`$ECHO '------------------------------------------------------------------------'|$CUT -c 1-$E`
# on source dist, we pick up freshly build executables
# on binary, use what is installed
@@ -125,16 +130,15 @@ else
MYSQLD="$BASEDIR/bin/mysqld"
MYSQL_TEST="$BASEDIR/bin/mysqltest"
MYSQLADMIN="$BASEDIR/bin/mysqladmin"
- INSTALL_DB="../scripts/install_test_db -bin"
+ INSTALL_DB="./install_test_db -bin"
fi
SLAVE_MYSQLD=$MYSQLD #this will be changed later if we are doing gcov
-
-MYSQL_TEST="$MYSQL_TEST --no-defaults --socket=$MASTER_MYSOCK --database=$DB --user=$DBUSER --password=$DBPASSWD --silent"
-GDB_MASTER_INIT=/tmp/gdbinit.master
-GDB_SLAVE_INIT=/tmp/gdbinit.slave
+MYSQL_TEST="$MYSQL_TEST --no-defaults --socket=$MASTER_MYSOCK --database=$DB --user=$DBUSER --password=$DBPASSWD --silent -v"
+GDB_MASTER_INIT=$MYSQL_TMP_DIR/gdbinit.master
+GDB_SLAVE_INIT=$MYSQL_TMP_DIR/gdbinit.slave
while test $# -gt 0; do
case "$1" in
@@ -142,19 +146,29 @@ while test $# -gt 0; do
--record ) RECORD=1 ;;
--gcov )
if [ x$BINARY_DIST = x1 ] ; then
- echo "Cannot do coverage test without the source - please use source dist"
+ $ECHO "Cannot do coverage test without the source - please use source dist"
exit 1
fi
DO_GCOV=1
;;
--gdb )
if [ x$BINARY_DIST = x1 ] ; then
- echo "Note: you will get more meaningful output on a source distribution compiled with debugging option when running tests with -gdb option"
+ $ECHO "Note: you will get more meaningful output on a source distribution compiled with debugging option when running tests with -gdb option"
fi
DO_GDB=1
;;
+ --ddd )
+ if [ x$BINARY_DIST = x1 ] ; then
+ $ECHO "Note: you will get more meaningful output on a source distribution compiled with debugging option when running tests with -gdb option"
+ fi
+ DO_DDD=1
+ ;;
+ --debug)
+ EXTRA_MASTER_MYSQLD_OPT=--debug=d:t:O,$MYSQL_TMP_DIR/master.trace
+ EXTRA_SLAVE_MYSQLD_OPT=--debug=d:t:O,$MYSQL_TMP_DIR/slave.trace
+ ;;
-- ) shift; break ;;
- --* ) echo "Unrecognized option: $1"; exit 1 ;;
+ --* ) $ECHO "Unrecognized option: $1"; exit 1 ;;
* ) break ;;
esac
shift
@@ -166,19 +180,22 @@ done
prompt_user ()
{
- echo $1
+ $ECHO $1
read unused
}
error () {
-
$ECHO "Error: $1"
exit 1
}
+error_is () {
+ $ECHO `$CAT $TIMEFILE` | $SED -e 's/.* At line \(.*\)\: \(.*\)Command .*$/ \>\> Error at line \1: \2<\</'
+}
+
prefix_to_8() {
- echo " $1" | $SED -e 's:.*\(........\)$:\1:'
+ $ECHO " $1" | $SED -e 's:.*\(........\)$:\1:'
}
pass_inc () {
@@ -189,13 +206,17 @@ fail_inc () {
TOT_FAIL=`$EXPR $TOT_FAIL + 1`
}
+skip_inc () {
+ TOT_SKIP=`$EXPR $TOT_SKIP + 1`
+}
+
total_inc () {
TOT_TEST=`$EXPR $TOT_TEST + 1`
}
report_stats () {
if [ $TOT_FAIL = 0 ]; then
- $ECHO "All tests successful."
+ $ECHO "All $TOT_TEST tests were successful."
else
xten=`$EXPR $TOT_PASS \* 10000`
raw=`$EXPR $xten / $TOT_TEST`
@@ -203,22 +224,21 @@ report_stats () {
whole=`$PRINTF %.2s $raw`
xwhole=`$EXPR $whole \* 100`
deci=`$EXPR $raw - $xwhole`
- $ECHO "Failed ${TOT_FAIL}/${TOT_TEST} tests ${whole}.${deci}% successful."
+ $ECHO "Failed ${TOT_FAIL}/${TOT_TEST} tests, ${whole}.${deci}% successful."
fi
}
mysql_install_db () {
- echo "Removing stale files from previous run"
+ $ECHO "Removing Stale Files"
$RM -rf $MASTER_MYDDIR $SLAVE_MYDDIR $SLAVE_MYLOG $MASTER_MYLOG \
$SLAVE_MYERR $MASTER_MYERR
- [ -d $MYRUN_DIR ] || mkdir -p $MYRUN_DIR
- echo "installing master databases"
+ $ECHO "Installing Master Databases"
$INSTALL_DB
if [ $? != 0 ]; then
error "Could not install master test DBs"
exit 1
fi
- echo "Installing slave databases"
+ $ECHO "Installing Slave Databases"
$INSTALL_DB -slave
if [ $? != 0 ]; then
error "Could not install slave test DBs"
@@ -244,13 +264,15 @@ gcov_collect () {
cd $MYSQL_TEST_DIR
done
- $ECHO "gcov info in $GCOV_MSG, errors in $GCOV_ERR"
+ $ECHO "gcov info in $GCOV_MSG, errors in $GCOV_ERR"
}
start_master()
{
[ x$MASTER_RUNNING = 1 ] && return
cd $BASEDIR # for gcov
+ # Remove old berkeley db log files that can confuse the server
+ $RM -f $MASTER_MYDDIR/log.*
#start master
master_args="--no-defaults --log-bin=master-bin \
--server-id=1 \
@@ -261,10 +283,15 @@ start_master()
--pid-file=$MASTER_MYPID \
--socket=$MASTER_MYSOCK \
--log=$MASTER_MYLOG \
- --language=english $EXTRA_MASTER_OPT"
- if [ x$DO_GDB = x1 ]
+ --language=english $EXTRA_MASTER_OPT $EXTRA_MASTER_MYSQLD_OPT"
+ if [ x$DO_DDD = x1 ]
+ then
+ $ECHO "set args $master_args" > $GDB_MASTER_INIT
+ ddd --debugger "gdb -x $GDB_MASTER_INIT" $MYSQLD &
+ prompt_user "Hit enter to continue after you've started the master"
+ elif [ x$DO_GDB = x1 ]
then
- echo "set args $master_args" > $GDB_MASTER_INIT
+ $ECHO "set args $master_args" > $GDB_MASTER_INIT
xterm -title "Master" -e gdb -x $GDB_MASTER_INIT $MYSQLD &
prompt_user "Hit enter to continue after you've started the master"
else
@@ -287,6 +314,7 @@ start_slave()
master_info=$SLAVE_MASTER_INFO
fi
+ $RM -f $SLAVE_MYDDIR/log.*
slave_args="--no-defaults $master_info \
--exit-info=256 \
--log-bin=slave-bin --log-slave-updates \
@@ -296,10 +324,15 @@ start_slave()
--port=$SLAVE_MYPORT \
--socket=$SLAVE_MYSOCK \
--log=$SLAVE_MYLOG \
- --language=english $EXTRA_SLAVE_OPT"
- if [ x$DO_GDB = x1 ]
+ --language=english $EXTRA_SLAVE_OPT $EXTRA_SLAVE_MYSQLD_OPT"
+ if [ x$DO_DDD = x1 ]
+ then
+ $ECHO "set args $master_args" > $GDB_SLAVE_INIT
+ ddd --debugger "gdb -x $GDB_SLAVE_INIT" $MYSQLD &
+ prompt_user "Hit enter to continue after you've started the master"
+ elif [ x$DO_GDB = x1 ]
then
- echo "set args $slave_args" > $GDB_SLAVE_INIT
+ $ECHO "set args $slave_args" > $GDB_SLAVE_INIT
xterm -title "Slave" -e gdb -x $GDB_SLAVE_INIT $SLAVE_MYSQLD &
prompt_user "Hit enter to continue after you've started the slave"
else
@@ -309,6 +342,7 @@ start_slave()
}
mysql_start () {
+ $ECHO "Starting MySQL daemon"
start_master
start_slave
cd $MYSQL_TEST_DIR
@@ -321,15 +355,15 @@ stop_slave ()
then
$MYSQLADMIN --no-defaults --socket=$SLAVE_MYSOCK -u root shutdown
if [ $? != 0 ] ; then # try harder!
- echo "slave not cooperating with mysqladmin, will try manual kill"
+ $ECHO "slave not cooperating with mysqladmin, will try manual kill"
kill `cat $SLAVE_MYPID`
sleep 2
if [ -f $SLAVE_MYPID ] ; then
- echo "slave refused to die, resorting to SIGKILL murder"
+ $ECHO "slave refused to die, resorting to SIGKILL murder"
kill -9 `cat $SLAVE_MYPID`
$RM -f $SLAVE_MYPID
else
- echo "slave responded to SIGTERM "
+ $ECHO "slave responded to SIGTERM "
fi
fi
SLAVE_RUNNING=0
@@ -342,15 +376,15 @@ stop_master ()
then
$MYSQLADMIN --no-defaults --socket=$MASTER_MYSOCK -u root shutdown
if [ $? != 0 ] ; then # try harder!
- echo "master not cooperating with mysqladmin, will try manual kill"
+ $ECHO "master not cooperating with mysqladmin, will try manual kill"
kill `cat $MASTER_MYPID`
sleep 2
if [ -f $MASTER_MYPID ] ; then
- echo "master refused to die, resorting to SIGKILL murder"
+ $ECHO "master refused to die, resorting to SIGKILL murder"
kill -9 `cat $MASTER_MYPID`
$RM -f $MASTER_MYPID
else
- echo "master responded to SIGTERM "
+ $ECHO "master responded to SIGTERM "
fi
fi
MASTER_RUNNING=0
@@ -359,6 +393,9 @@ stop_master ()
mysql_stop ()
{
+ $ECHO "Ending Tests"
+ $ECHO "Shutting-down MySQL daemon"
+ $ECHO
stop_master
stop_slave
return 1
@@ -438,12 +475,12 @@ run_testcase ()
cd $MYSQL_TEST_DIR
if [ -f $tf ] ; then
- $RM -f r/$tname.*.reject
+ $RM -f r/$tname.*reject
mytime=`$TIME -p $MYSQL_TEST -R r/$tname.result $extra_flags \
< $tf 2> $TIMEFILE`
res=$?
- if [ $res != 1 ]; then
+ if [ $res = 0 ]; then
mytime=`$CAT $TIMEFILE | $TR '\n' '-'`
USERT=`$ECHO $mytime | $CUT -d - -f 2 | $CUT -d ' ' -f 2`
@@ -460,55 +497,67 @@ run_testcase ()
timestr="$USERT $SYST $REALT"
pname=`$ECHO "$tname "|$CUT -c 1-16`
- $SETCOLOR_NORMAL && $ECHO -n "$pname $timestr"
+ $ECHO -n "$pname $timestr"
- total_inc
- if [ $res != 0 ]; then
+ if [ $res = 0 ]; then
+ total_inc
+ pass_inc
+ $ECHO "$RES_SPACE [ pass ]"
+ else
+ if [ $res = 1 ]; then
+ total_inc
fail_inc
- echo "$RES_SPACE [ fail ]"
- $ECHO "failed output"
- $CAT $TIMEFILE
- $ECHO
+ $ECHO "$RES_SPACE [ fail ]"
+ $ECHO
+ error_is
$ECHO
if [ x$FORCE != x1 ] ; then
- echo "Aborting, if you want to continue, re-run with --force"
+ $ECHO "Aborting. To continue, re-run with '--force'."
+ $ECHO
mysql_stop
exit 1
fi
- echo "Restarting mysqld"
mysql_restart
- echo "Resuming Tests"
- else
- pass_inc
- echo "$RES_SPACE [ pass ]"
+ $ECHO "Resuming Tests"
+ $ECHO
+ else
+ pass_inc
+ $ECHO "$RES_SPACE [ skipped ]"
+ fi
fi
fi
-
}
+######################################################################
+# Main script starts here
+######################################################################
+
[ "$DO_GCOV" -a ! -x "$GCOV" ] && error "No gcov found"
[ "$DO_GCOV" ] && gcov_prepare
-echo "Installing test databases"
+# Ensure that no old mysqld test servers are running
+$MYSQLADMIN --no-defaults --socket=$MASTER_MYSOCK -u root -O connect_timeout=5 shutdown > /dev/null 2>&1
+$MYSQLADMIN --no-defaults --socket=$SLAVE_MYSOCK -u root -O connect_timeout=5 shutdown > /dev/null 2>&1
+
+$ECHO "Installing Test Databases"
mysql_install_db
#do not automagically start deamons if we are in gdb or running only one test
#case
-if [ -z "$DO_GDB" ] && [ -z "$1" ]
+if [ -z "$DO_GDB" ] && [ -z "$1" ] && [ -z "$DO_DDD" ]
then
- $ECHO "Starting mysqld for Testing"
mysql_start
fi
-$ECHO "Loading Standard Test Database"
+$ECHO "Loading Standard Test Databases"
mysql_loadstd
-$ECHO "Starting Tests for MySQL daemon"
+$ECHO "Starting Tests"
$ECHO
$ECHO " TEST USER SYSTEM ELAPSED RESULT"
@@ -517,7 +566,7 @@ $ECHO $DASH72
if [ -z "$1" ] ;
then
if [ x$RECORD = x1 ]; then
- echo "Will not run in record mode without a specific test case"
+ $ECHO "Will not run in record mode without a specific test case."
else
for tf in $TESTDIR/*.$TESTSUFFIX
do
@@ -525,27 +574,25 @@ then
done
fi
else
- tf=$TESTDIR/$1.$TESTSUFFIX
+ tname=`$BASENAME $1 .test`
+ tf=$TESTDIR/$tname.$TESTSUFFIX
if [ -f $tf ] ; then
run_testcase $tf
else
- echo "Test case $tf does not exist"
+ $ECHO "Test case $tf does not exist."
fi
fi
$ECHO $DASH72
$ECHO
-$ECHO "Ending Tests for MySQL daemon"
-$RM $TIMEFILE
-if [ -z "$DO_GDB" ] ;
+$RM -f $TIMEFILE
+
+if [ -z "$DO_GDB" ] && [ -z "$DO_DDD" ]
then
- $ECHO "Shutdown mysqld"
mysql_stop
fi
-
-$ECHO
report_stats
$ECHO
diff --git a/mysql-test/r/3.23/README b/mysql-test/r/3.23/README
deleted file mode 100644
index e69de29bb2d..00000000000
--- a/mysql-test/r/3.23/README
+++ /dev/null
diff --git a/mysql-test/r/alt000001.result b/mysql-test/r/alt000001.result
deleted file mode 100644
index cc95b808d23..00000000000
--- a/mysql-test/r/alt000001.result
+++ /dev/null
@@ -1,5 +0,0 @@
-n
-3
-9
-10
-12
diff --git a/mysql-test/r/alter_table.result b/mysql-test/r/alter_table.result
new file mode 100644
index 00000000000..349f65509a8
--- /dev/null
+++ b/mysql-test/r/alter_table.result
@@ -0,0 +1,27 @@
+bandID payoutID new_col
+6 1 NULL
+3 4 NULL
+1 6 NULL
+2 6 NULL
+4 9 NULL
+5 10 NULL
+7 12 NULL
+8 12 NULL
+bandID payoutID new_col
+1 6 NULL
+2 6 NULL
+3 4 NULL
+4 9 NULL
+5 10 NULL
+6 1 NULL
+7 12 NULL
+8 12 NULL
+Field Type Null Key Default Extra Privileges
+GROUP_ID int(10) unsigned PRI 0 select,insert,update,references
+LANG_ID smallint(5) unsigned PRI 0 select,insert,update,references
+NAME char(80) MUL select,insert,update,references
+n
+3
+9
+10
+12
diff --git a/mysql-test/r/analyse.result b/mysql-test/r/analyse.result
new file mode 100644
index 00000000000..f6b8cc2fcbf
--- /dev/null
+++ b/mysql-test/r/analyse.result
@@ -0,0 +1,6 @@
+Field_name Min_value Max_value Min_length Max_length Empties_or_zeros Nulls Avg_value_or_avg_length Std Optimal_fieldtype
+t1.i 1 7 1 1 0 0 4.0000 2.2361 ENUM('1','3','5','7') NOT NULL
+t1.j 2 8 1 1 0 0 5.0000 2.2361 ENUM('2','4','6','8') NOT NULL
+Field_name Min_value Max_value Min_length Max_length Empties_or_zeros Nulls Avg_value_or_avg_length Std Optimal_fieldtype
+t1.i 1 7 1 1 0 0 4.0000 2.2361 ENUM('1','3','5','7') NOT NULL
+t1.j 2 8 1 1 0 0 5.0000 2.2361 ENUM('2','4','6','8') NOT NULL
diff --git a/mysql-test/r/auto_increment.result b/mysql-test/r/auto_increment.result
new file mode 100644
index 00000000000..9ff02d7a7b8
--- /dev/null
+++ b/mysql-test/r/auto_increment.result
@@ -0,0 +1,57 @@
+a b
+1 1
+3 3
+5 5
+6 6
+a b c
+1 1 NULL
+3 3 3
+5 5 NULL
+8 8 8
+9 9 9
+a b
+1 1
+5 5
+3 3
+4 4
+6 6
+a b c
+1 1 NULL
+5 5 NULL
+3 3 NULL
+4 4 NULL
+6 6 6
+skey sval
+1 hello
+2 hey
+_rowid _rowid skey sval
+1 1 1 hello
+2 2 2 hey
+a b
+a 1
+a 2
+a 3
+a 4
+a 5
+b 2
+b 3
+b 4
+c 1
+c 2
+c 3
+d 1
+d 2
+d 5
+e 1
+k 1
+ordid ord
+1 sdj
+2 sdj
+ordid ord
+1 abc
+2 abc
+3 abc
+1 sdj
+2 sdj
+3 sdj
+1 zzz
diff --git a/mysql-test/r/bdb.result b/mysql-test/r/bdb.result
new file mode 100644
index 00000000000..3d5bf5f0edb
--- /dev/null
+++ b/mysql-test/r/bdb.result
@@ -0,0 +1,404 @@
+id code name
+1 1 Tim
+2 1 Monty
+3 2 David
+4 2 Erik
+5 3 Sasha
+6 3 Jeremy
+7 4 Matt
+id code name
+2 1 Monty
+3 2 David
+4 2 Erik
+5 3 Sasha
+6 3 Jeremy
+7 4 Matt
+8 1 Sinisa
+id code name
+3 2 David
+4 2 Erik
+5 3 Sasha
+6 3 Jeremy
+7 4 Matt
+8 1 Sinisa
+12 1 Ralph
+id parent_id level
+8 102 2
+9 102 2
+15 102 2
+id parent_id level
+1001 100 0
+1002 101 1
+1003 101 1
+1004 101 1
+1005 101 1
+1006 101 1
+1007 101 1
+1008 102 2
+1009 102 2
+1015 102 2
+1016 103 2
+1017 103 2
+1018 103 2
+1019 103 2
+1020 103 2
+1021 104 2
+1022 104 2
+1024 104 2
+1025 105 2
+1026 105 2
+1027 105 2
+1028 105 2
+1029 105 2
+1030 105 2
+1031 106 2
+1032 106 2
+1033 106 2
+1034 106 2
+1035 106 2
+1036 107 2
+1037 107 2
+1038 107 2
+1040 107 2
+1157 100 0
+1179 105 2
+1183 104 2
+1193 105 2
+1202 107 2
+1203 107 2
+id parent_id level
+1001 100 0
+1002 101 1
+1003 101 1
+1004 101 1
+1005 101 1
+1006 101 1
+1007 101 1
+1008 102 2
+1010 102 2
+1015 102 2
+1016 103 2
+1017 103 2
+1018 103 2
+1019 103 2
+1020 103 2
+1021 104 2
+1023 104 2
+1024 104 2
+1025 105 2
+1026 105 2
+1027 105 2
+1028 105 2
+1029 105 2
+1030 105 2
+1031 106 2
+1032 106 2
+1033 106 2
+1034 106 2
+1035 106 2
+1036 107 2
+1037 107 2
+1039 107 2
+1041 107 2
+1158 100 0
+1180 105 2
+1184 104 2
+1194 105 2
+1202 107 2
+1204 107 2
+id parent_id level
+1008 102 2
+1015 102 2
+1010 102 2
+table type possible_keys key key_len ref rows Extra
+t1 ref level level 1 const 1 where used; Using index
+table type possible_keys key key_len ref rows Extra
+t1 ref level level 1 const 1 where used; Using index
+table type possible_keys key key_len ref rows Extra
+t1 ref level level 1 const 1 where used
+level id
+1 1002
+1 1003
+1 1004
+1 1005
+1 1006
+1 1007
+level id parent_id
+1 1002 101
+1 1003 101
+1 1004 101
+1 1005 101
+1 1006 101
+1 1007 101
+gesuchnr benutzer_id
+1 1
+2 1
+a
+2
+a b
+a 1
+a 2
+a 3
+a 4
+a 5
+b 2
+b 3
+b 4
+c 1
+c 2
+c 3
+d 1
+d 2
+d 5
+e 1
+k 1
+n after rollback
+n after commit
+4 after commit
+n after commit
+4 after commit
+5 after commit
+n
+4
+5
+6
+afterbegin_id afterbegin_nom
+1 hamdouni
+afterrollback_id afterrollback_nom
+afterautocommit0_id afterautocommit0_nom
+2 mysql
+afterrollback_id afterrollback_nom
+id val
+id val
+pippo 12
+id val
+ID NAME
+1 Jochen
+_userid
+marc@anyware.co.uk
+_userid
+marc@anyware.co.uk
+user_id name phone ref_email detail
+10292 sanjeev 29153373 sansh777@hotmail.com xxx
+10292 shirish 2333604 shirish@yahoo.com ddsds
+10292 sonali 323232 sonali@bolly.com filmstar
+user_id name phone ref_email detail
+10292 sanjeev 29153373 sansh777@hotmail.com xxx
+10292 shirish 2333604 shirish@yahoo.com ddsds
+10292 sonali 323232 sonali@bolly.com filmstar
+user_id name phone ref_email detail
+10292 sanjeev 29153373 sansh777@hotmail.com xxx
+10292 shirish 2333604 shirish@yahoo.com ddsds
+10292 sonali 323232 sonali@bolly.com filmstar
+10293 shirish 2333604 shirish@yahoo.com ddsds
+user_id name phone ref_email detail
+10293 shirish 2333604 shirish@yahoo.com ddsds
+user_id name phone ref_email detail
+10291 sanjeev 29153373 sansh777@hotmail.com xxx
+Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Comment
+t1 0 PRIMARY 1 a A NULL NULL NULL
+t1 0 PRIMARY 2 b A 0 NULL NULL
+t1 0 b 1 b A 0 NULL NULL
+t1 0 c 1 c A 0 NULL NULL
+t1 1 a 1 a A NULL NULL NULL
+t1 1 a_2 1 a A NULL NULL NULL
+col1 col2
+1 1
+2 3
+3 4
+4 4
+5 2
+col1 col2
+1 1
+2 3
+3 4
+4 7
+5 2
+col1 col2 co3
+1 1 0
+2 3 0
+3 4 0
+4 7 0
+5 2 0
+col1 col2 co3
+1 1 0
+2 9 0
+3 4 0
+4 7 0
+5 2 0
+a b
+1 3
+2 3
+3 3
+a b
+1 3
+2 3
+3 3
+a b
+a b
+1 3
+2 3
+3 3
+a b
+1 3
+2 3
+3 3
+id ggid email passwd
+1 test1 xxx
+id ggid email passwd
+1 test1 xxx
+id ggid email passwd
+2 test2 yyy
+user_name password subscribed user_id quota weight access_date access_time approved dummy_primary_key
+user_0 somepassword N 0 0 0 2000-09-07 23:06:59 2000-09-07 23:06:59 1
+user_1 somepassword Y 1 1 1 2000-09-07 23:06:59 2000-09-07 23:06:59 2
+user_2 somepassword N 2 2 1.4142135623731 2000-09-07 23:06:59 2000-09-07 23:06:59 3
+user_3 somepassword Y 3 3 1.7320508075689 2000-09-07 23:06:59 2000-09-07 23:06:59 4
+user_4 somepassword N 4 4 2 2000-09-07 23:06:59 2000-09-07 23:06:59 5
+id parent_id level
+8 102 2
+9 102 2
+15 102 2
+id parent_id level
+1001 100 0
+1003 101 1
+1004 101 1
+1008 102 2
+1024 102 2
+1017 103 2
+1022 104 2
+1024 104 2
+1028 105 2
+1029 105 2
+1030 105 2
+1031 106 2
+1032 106 2
+1033 106 2
+1203 107 2
+1202 107 2
+1020 103 2
+1157 100 0
+1193 105 2
+1040 107 2
+1002 101 1
+1015 102 2
+1006 101 1
+1034 106 2
+1035 106 2
+1016 103 2
+1007 101 1
+1036 107 2
+1018 103 2
+1026 105 2
+1027 105 2
+1183 104 2
+1038 107 2
+1025 105 2
+1037 107 2
+1021 104 2
+1019 103 2
+1005 101 1
+1179 105 2
+id parent_id level
+1002 100 0
+1004 101 1
+1005 101 1
+1009 102 2
+1025 102 2
+1018 103 2
+1023 104 2
+1025 104 2
+1029 105 2
+1030 105 2
+1031 105 2
+1032 106 2
+1033 106 2
+1034 106 2
+1204 107 2
+1203 107 2
+1021 103 2
+1158 100 0
+1194 105 2
+1041 107 2
+1003 101 1
+1016 102 2
+1007 101 1
+1035 106 2
+1036 106 2
+1017 103 2
+1008 101 1
+1037 107 2
+1019 103 2
+1027 105 2
+1028 105 2
+1184 104 2
+1039 107 2
+1026 105 2
+1038 107 2
+1022 104 2
+1020 103 2
+1006 101 1
+1180 105 2
+id parent_id level
+1009 102 2
+1025 102 2
+1016 102 2
+table type possible_keys key key_len ref rows Extra
+t1 ref level level 1 const 1 where used; Using index
+level id
+1 1004
+1 1005
+1 1003
+1 1007
+1 1008
+1 1006
+level id parent_id
+1 1004 101
+1 1005 101
+1 1003 101
+1 1007 101
+1 1008 101
+1 1006 101
+level id
+1 1003
+1 1004
+1 1005
+1 1006
+1 1007
+1 1008
+id parent_id level
+1002 100 0
+1009 102 2
+1025 102 2
+1018 103 2
+1023 104 2
+1025 104 2
+1029 105 2
+1030 105 2
+1031 105 2
+1032 106 2
+1033 106 2
+1034 106 2
+1204 107 2
+1203 107 2
+1021 103 2
+1158 100 0
+1194 105 2
+1041 107 2
+1016 102 2
+1035 106 2
+1036 106 2
+1017 103 2
+1037 107 2
+1019 103 2
+1027 105 2
+1028 105 2
+1184 104 2
+1039 107 2
+1026 105 2
+1038 107 2
+1022 104 2
+1020 103 2
+1180 105 2
+count(*)
+1
diff --git a/mysql-test/r/bigint.result b/mysql-test/r/bigint.result
new file mode 100644
index 00000000000..501f489ca86
--- /dev/null
+++ b/mysql-test/r/bigint.result
@@ -0,0 +1,13 @@
+0 256 00000000000000065536 2147483647 -2147483648 2147483648 +4294967296
+0 256 65536 2147483647 -2147483648 2147483648 4294967296
+922337203685477580 92233720368547758000
+922337203685477580 92233720368547758080
+-922337203685477580 -92233720368547758000
+-922337203685477580 -92233720368547758080
+9223372036854775807 -009223372036854775808
+9223372036854775807 -9223372036854775808
++9999999999999999999 -9999999999999999999
+10000000000000000000 -10000000000000000000
+a
+18446744073709551615
+18446744073709551615
diff --git a/mysql-test/r/binary.result b/mysql-test/r/binary.result
new file mode 100644
index 00000000000..c5f9961699d
--- /dev/null
+++ b/mysql-test/r/binary.result
@@ -0,0 +1,33 @@
+name
+concat("*",name,"*")
+*å*
+*ä*
+*ö*
+min(name) min(concat("*",name,"*")) max(name) max(concat("*",name,"*"))
+å *å* ö *ö*
+name
+concat("*",name,"*")
+*ä*
+*å*
+*ö*
+min(name) min(concat("*",name,"*")) max(name) max(concat("*",name,"*"))
+ä *ä* ö *ö*
+name
+name
+name
+a b
+hello hello
+a b
+a b
+hello hello
diff --git a/mysql-test/r/case.result b/mysql-test/r/case.result
new file mode 100644
index 00000000000..66538c2fbee
--- /dev/null
+++ b/mysql-test/r/case.result
@@ -0,0 +1,34 @@
+CASE "b" when "a" then 1 when "b" then 2 END
+2
+CASE "c" when "a" then 1 when "b" then 2 END
+NULL
+CASE "c" when "a" then 1 when "b" then 2 ELSE 3 END
+3
+CASE BINARY "b" when "a" then 1 when "B" then 2 WHEN "b" then "ok" END
+ok
+CASE "b" when "a" then 1 when binary "B" then 2 WHEN "b" then "ok" END
+ok
+CASE concat("a","b") when concat("ab","") then "a" when "b" then "b" end
+a
+CASE when 1=0 then "true" else "false" END
+false
+CASE 1 when 1 then "one" WHEN 2 then "two" ELSE "more" END
+one
+CASE 2.0 when 1 then "one" WHEN 2.0 then "two" ELSE "more" END
+two
+(CASE "two" when "one" then "1" WHEN "two" then "2" END) | 0
+2
+(CASE "two" when "one" then 1.00 WHEN "two" then 2.00 END) +0.0
+2.00
+case 1/0 when "a" then "true" else "false" END
+false
+case 1/0 when "a" then "true" END
+NULL
+(case 1/0 when "a" then "true" END) | 0
+NULL
+(case 1/0 when "a" then "true" END) + 0.0
+NULL
+case when 1>0 then "TRUE" else "FALSE" END
+TRUE
+case when 1<0 then "TRUE" else "FALSE" END
+FALSE
diff --git a/mysql-test/r/comments.result b/mysql-test/r/comments.result
new file mode 100644
index 00000000000..7044667e4af
--- /dev/null
+++ b/mysql-test/r/comments.result
@@ -0,0 +1,15 @@
+1+2/*hello*/+3
+6
+1
+1
+1 /*!32301 +1
+2
+1
+1
+1--1
+2
+1 --2
++1
+4
+1
+1
diff --git a/mysql-test/r/compare.result b/mysql-test/r/compare.result
new file mode 100644
index 00000000000..6af85c16dff
--- /dev/null
+++ b/mysql-test/r/compare.result
@@ -0,0 +1,6 @@
+table type possible_keys key key_len ref rows Extra
+t1 index PRIMARY PRIMARY 12 NULL 2 where used; Using index
+id
+000000000001
+id
+000000000001
diff --git a/mysql-test/r/count_distinct.result b/mysql-test/r/count_distinct.result
new file mode 100644
index 00000000000..6fc10f590ec
--- /dev/null
+++ b/mysql-test/r/count_distinct.result
@@ -0,0 +1,9 @@
+isbn city libname a
+007 Berkeley Berkeley Public1 1
+007 Berkeley Berkeley Public2 1
+000 New York New York Public Libra 6
+001 New York NYC Lib 1
+006 San Fran San Fransisco Public 1
+isbn city libname a
+007 Berkeley Berkeley Public1 2
+000 New York New York Public Libra 2
diff --git a/mysql-test/r/create.result b/mysql-test/r/create.result
new file mode 100644
index 00000000000..f32c9b0bc80
--- /dev/null
+++ b/mysql-test/r/create.result
@@ -0,0 +1,10 @@
+b
+
+NULL
+b
+
+
+1a20 1e+ 1e+10
+1 10000000001
+a$1 $b c$
+1 2 3
diff --git a/mysql-test/r/crypt.result b/mysql-test/r/crypt.result
deleted file mode 100644
index fe3f80dc90d..00000000000
--- a/mysql-test/r/crypt.result
+++ /dev/null
@@ -1,2 +0,0 @@
-encrypt('foo', 'ff')
-ffTU0fyIP09Z.
diff --git a/mysql-test/r/delayed.result b/mysql-test/r/delayed.result
new file mode 100644
index 00000000000..c3281ce5330
--- /dev/null
+++ b/mysql-test/r/delayed.result
@@ -0,0 +1,5 @@
+a tmsp
+a tmsp
+5 19711006010203
+6 19711006010203
+8 19711006010203
diff --git a/mysql-test/r/delete.result b/mysql-test/r/delete.result
deleted file mode 100644
index e69de29bb2d..00000000000
--- a/mysql-test/r/delete.result
+++ /dev/null
diff --git a/mysql-test/r/distinct.result b/mysql-test/r/distinct.result
new file mode 100644
index 00000000000..79c55e45342
--- /dev/null
+++ b/mysql-test/r/distinct.result
@@ -0,0 +1,155 @@
+id
+NULL
+-1
+0
+1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+id facility
+NULL NULL
+-1
+0
+1 /L
+2 A01
+3 ANC
+4 F01
+5 FBX
+6 MT
+7 P
+8 RV
+9 SRV
+10 VMT
+id-5 facility
+NULL NULL
+-6
+-5
+-4 /L
+-3 A01
+-2 ANC
+-1 F01
+0 FBX
+1 MT
+2 P
+3 RV
+4 SRV
+5 VMT
+id concat(facility)
+NULL NULL
+-1
+0
+1 /L
+2 A01
+3 ANC
+4 F01
+5 FBX
+6 MT
+7 P
+8 RV
+9 SRV
+10 VMT
+a max(id) b
+10 10 VMT
+9 9 SRV
+8 8 RV
+7 7 P
+6 6 MT
+5 5 FBX
+4 4 F01
+3 3 ANC
+2 2 A01
+1 1 /L
+-1 -1
+0 0
+NULL NULL NULL
+grp count(*)
+0 7
+1 6
+FACILITY
+NULL
+
+/L
+A01
+ANC
+F01
+FBX
+MT
+P
+RV
+SRV
+VMT
+FACILITY
+NULL
+
+/L
+A01
+ANC
+F01
+FBX
+MT
+P
+RV
+SRV
+VMT
+count(*)
+12
+count(facility)
+12
+count(*)
+13
+count(*)
+1
+count(*)
+0
+count(*)
+12
+count(*)
+1
+count(*)
+12
+UserId
+UserId
+UserId
+UserId
+b
+1
+table type possible_keys key key_len ref rows Extra
+t3 index a a 4 NULL 6 Using index; Using temporary
+t2 index a a 4 NULL 5 Using index; Distinct
+t1 eq_ref PRIMARY PRIMARY 4 t2.a 1 where used; Distinct
+a
+1
+table type possible_keys key key_len ref rows Extra
+t1 index PRIMARY PRIMARY 4 NULL 2 Using index; Using temporary
+t3 ref a a 5 t1.a 12 Using index; Distinct
+a
+1
+2
+1
+1
+name
+aa
+ab
+name
+aa
+ab
+1
+1
+key_link_id link
+NULL NULL
+table type possible_keys key key_len ref rows Extra
+t1 index id id 4 NULL 2 Using index; Using temporary
+t2 index id id 8 NULL 1 Using index; Distinct
+t3 index id id 8 NULL 1 Using index; Distinct
+j_lj_t2 index id id 4 NULL 2 where used; Using index; Distinct
+t2_lj index id id 8 NULL 1 where used; Using index; Distinct
+j_lj_t3 index id id 4 NULL 2 where used; Using index; Distinct
+t3_lj index id id 8 NULL 1 where used; Using index; Distinct
+id
+2
diff --git a/mysql-test/r/empty_table.result b/mysql-test/r/empty_table.result
new file mode 100644
index 00000000000..284ed65ee3b
--- /dev/null
+++ b/mysql-test/r/empty_table.result
@@ -0,0 +1,4 @@
+count(*)
+0
+nr b str
+nr b str
diff --git a/mysql-test/r/equal.result b/mysql-test/r/equal.result
deleted file mode 100644
index 9de9eafee6a..00000000000
--- a/mysql-test/r/equal.result
+++ /dev/null
@@ -1,15 +0,0 @@
-0<=>0 0.0<=>0.0 "A"<=>"A" NULL<=>NULL
-1 1 1 1
-1<=>0 0<=>NULL NULL<=>0
-0 0 0
-1.0<=>0.0 0.0<=>NULL NULL<=>0.0
-0 0 0
-"A"<=>"B" "A"<=>NULL NULL<=>"A"
-0 0 0
-id value id value t1.value<=>t2.value
-1 NULL 1 NULL 1
-id value
-1 NULL
-id value
-1 NULL
-id value
diff --git a/mysql-test/r/explain.result b/mysql-test/r/explain.result
new file mode 100644
index 00000000000..558feb10f84
--- /dev/null
+++ b/mysql-test/r/explain.result
@@ -0,0 +1,15 @@
+id str
+1 NULL
+2 NULL
+id str
+3 foo
+table type possible_keys key key_len ref rows Extra
+t1 ref str str 11 const 1 where used
+table type possible_keys key key_len ref rows Extra
+t1 const str str 11 const 1
+table type possible_keys key key_len ref rows Extra
+t1 ALL str NULL NULL NULL 4 where used
+table type possible_keys key key_len ref rows Extra
+t1 const str str 11 const 1
+Comment
+No tables used
diff --git a/mysql-test/r/ft0000001.a.result b/mysql-test/r/ft0000001.a.result
index 2b9a1515532..0a99bccec1e 100644
--- a/mysql-test/r/ft0000001.a.result
+++ b/mysql-test/r/ft0000001.a.result
@@ -1,3 +1,3 @@
-a MATCH (message) AGAINST ('steve')
-4 0.90587321329654
-7 0.89568988462614
+a MATCH (message) AGAINST ('steve')
+4 0.90587321329654
+7 0.89568988462614
diff --git a/mysql-test/r/ft0000001.b.result b/mysql-test/r/ft0000001.b.result
index 2b9a1515532..0a99bccec1e 100644
--- a/mysql-test/r/ft0000001.b.result
+++ b/mysql-test/r/ft0000001.b.result
@@ -1,3 +1,3 @@
-a MATCH (message) AGAINST ('steve')
-4 0.90587321329654
-7 0.89568988462614
+a MATCH (message) AGAINST ('steve')
+4 0.90587321329654
+7 0.89568988462614
diff --git a/mysql-test/r/ft0000001.c.result b/mysql-test/r/ft0000001.c.result
index a88e4b25f2e..0a495a119e2 100644
--- a/mysql-test/r/ft0000001.c.result
+++ b/mysql-test/r/ft0000001.c.result
@@ -1,3 +1,3 @@
-a MATCH (message) AGAINST ('steve')
-7 0.89568988462614
-4 0.90587321329654
+a MATCH (message) AGAINST ('steve')
+7 0.89568988462614
+4 0.90587321329654
diff --git a/mysql-test/r/ft0000001.d.result b/mysql-test/r/ft0000001.d.result
index f9ffb78d49d..c3c145b2744 100644
--- a/mysql-test/r/ft0000001.d.result
+++ b/mysql-test/r/ft0000001.d.result
@@ -1,2 +1,2 @@
-a MATCH (message) AGAINST ('steve')
-7 0.89568988462614
+a MATCH (message) AGAINST ('steve')
+7 0.89568988462614
diff --git a/mysql-test/r/ft0000001.e.result b/mysql-test/r/ft0000001.e.result
index 90d27233ec5..372839e5cf8 100644
--- a/mysql-test/r/ft0000001.e.result
+++ b/mysql-test/r/ft0000001.e.result
@@ -1,8 +1,8 @@
-a rel
-1 0
-2 0
-3 0
-5 0
-6 0
-7 0.89568988462614
-4 0.90587321329654
+a rel
+1 0
+2 0
+3 0
+5 0
+6 0
+7 0.89568988462614
+4 0.90587321329654
diff --git a/mysql-test/r/ft0000002.a.result b/mysql-test/r/ft0000002.a.result
index f48a6a4fb5e..576b086d13c 100644
--- a/mysql-test/r/ft0000002.a.result
+++ b/mysql-test/r/ft0000002.a.result
@@ -1,4 +1,4 @@
-a MATCH b AGAINST ('lala lkjh')
-1 0.67003110026735
-2 0
-3 0
+a MATCH b AGAINST ('lala lkjh')
+1 0.67003110026735
+2 0
+3 0
diff --git a/mysql-test/r/ft0000002.b.result b/mysql-test/r/ft0000002.b.result
index aeaf0283ba6..d18d3484f21 100644
--- a/mysql-test/r/ft0000002.b.result
+++ b/mysql-test/r/ft0000002.b.result
@@ -1,4 +1,4 @@
-a MATCH c AGAINST ('lala lkjh')
-1 0
-2 0.67756324121582
-3 0
+a MATCH c AGAINST ('lala lkjh')
+1 0
+2 0.67756324121582
+3 0
diff --git a/mysql-test/r/ft0000002.c.result b/mysql-test/r/ft0000002.c.result
index 2993e25d842..58179329034 100644
--- a/mysql-test/r/ft0000002.c.result
+++ b/mysql-test/r/ft0000002.c.result
@@ -1,4 +1,4 @@
-a MATCH b,c AGAINST ('lala lkjh')
-1 0.64840710366884
-2 0.66266459031789
-3 0
+a MATCH b,c AGAINST ('lala lkjh')
+1 0.64840710366884
+2 0.66266459031789
+3 0
diff --git a/mysql-test/r/fulltext.result b/mysql-test/r/fulltext.result
new file mode 100644
index 00000000000..7d9ba18d933
--- /dev/null
+++ b/mysql-test/r/fulltext.result
@@ -0,0 +1,8 @@
+a b
+Only MyISAM tables support collections
+Full-text indexes are called collections
+a b
+Full-text indexes are called collections
+a b
+Full-text indexes are called collections
+Only MyISAM tables support collections
diff --git a/mysql-test/r/func_crypt.result b/mysql-test/r/func_crypt.result
new file mode 100644
index 00000000000..7e0f5f7981d
--- /dev/null
+++ b/mysql-test/r/func_crypt.result
@@ -0,0 +1,2 @@
+encrypt('foo', 'ff')
+ffTU0fyIP09Z.
diff --git a/mysql-test/r/func_date_add.result b/mysql-test/r/func_date_add.result
new file mode 100644
index 00000000000..3bc0fb1aff3
--- /dev/null
+++ b/mysql-test/r/func_date_add.result
@@ -0,0 +1,12 @@
+visitor_id mts
+48985536 20000319013932
+173865424 20000318233615
+357917728 20000319145027
+465931136 20000318160953
+1092858576 20000319013445
+visitor_id mts
+48985536 20000319013932
+173865424 20000318233615
+357917728 20000319145027
+465931136 20000318160953
+1092858576 20000319013445
diff --git a/mysql-test/r/func_equal.result b/mysql-test/r/func_equal.result
new file mode 100644
index 00000000000..6e2933641aa
--- /dev/null
+++ b/mysql-test/r/func_equal.result
@@ -0,0 +1,15 @@
+0<=>0 0.0<=>0.0 "A"<=>"A" NULL<=>NULL
+1 1 1 1
+1<=>0 0<=>NULL NULL<=>0
+0 0 0
+1.0<=>0.0 0.0<=>NULL NULL<=>0.0
+0 0 0
+"A"<=>"B" "A"<=>NULL NULL<=>"A"
+0 0 0
+id value id value t1.value<=>t2.value
+1 NULL 1 NULL 1
+id value
+1 NULL
+id value
+1 NULL
+id value
diff --git a/mysql-test/r/func_group.result b/mysql-test/r/func_group.result
new file mode 100644
index 00000000000..ea9a06123ae
--- /dev/null
+++ b/mysql-test/r/func_group.result
@@ -0,0 +1,86 @@
+a c sum(a)
+1 a 1
+2 b 2
+3 c 3
+4 E 4
+5 C 5
+6 D 6
+a c sum(a)
+sum(a)
+NULL
+a
+1
+3
+6
+5
+2
+4
+a
+1
+3
+6
+5
+2
+4
+count(distinct a) count(distinct grp)
+6 3
+count(distinct a) count(distinct grp)
+6 3
+sum(a) count(a) avg(a) std(a) bit_or(a) bit_and(a) min(a) max(a) min(c) max(c)
+21 6 3.5000 1.7078 7 0 1 6 E
+grp sum(a) count(a) avg(a) std(a) bit_or(a) bit_and(a) min(a) max(a) min(c) max(c)
+NULL 0 0 NULL NULL 0 0 NULL NULL
+1 1 1 1.0000 0.0000 1 1 1 1 a a
+2 5 2 2.5000 0.5000 3 2 2 3 b c
+3 15 3 5.0000 0.8165 7 4 4 6 C E
+grp sum
+NULL NULL
+1 7
+2 20
+3 44.816496580928
+grp a c
+NULL NULL
+1 2 a
+2 5 c
+3 9 E
+2 3 c
+id avg(value1) std(value1)
+1 1.000000 0.816497
+2 11.000000 0.816497
+name avg(value1) std(value1)
+Set One 1.000000 0.816497
+Set Two 11.000000 0.816497
+id avg(rating)
+1 3.0000
+2 NULL
+3 2.0000
+count(*)
+3
+count(*)
+1
+count(*)
+0
+count(*)
+0
+count(a)
+1
+count(a)
+0
+count(a)
+0
+count(b)
+2
+count(b)
+0
+count(c)
+0
+COUNT(i) i COUNT(i)*i
+1 1 1
+COUNT(i) (i+0) COUNT(i)*(i+0)
+1 1 1
+sum(num)
+147.58
+sum(num)
+50.15
+45.63
+51.80
diff --git a/mysql-test/r/func_in.result b/mysql-test/r/func_in.result
new file mode 100644
index 00000000000..f201d371876
--- /dev/null
+++ b/mysql-test/r/func_in.result
@@ -0,0 +1,14 @@
+field
+field
+A
+field
+A
+field
+A
+NULL
+field
+NULL
+id
+2
+5
+9
diff --git a/mysql-test/r/func_like.result b/mysql-test/r/func_like.result
new file mode 100644
index 00000000000..78bede19762
--- /dev/null
+++ b/mysql-test/r/func_like.result
@@ -0,0 +1,7 @@
+a
+abc
+abcd
+a
+test
+a
+test
diff --git a/mysql-test/r/func_math.result b/mysql-test/r/func_math.result
new file mode 100644
index 00000000000..33d1dfe65e7
--- /dev/null
+++ b/mysql-test/r/func_math.result
@@ -0,0 +1,22 @@
+floor(5.5) floor(-5.5)
+5 -6
+ceiling(5.5) ceiling(-5.5)
+6 -5
+truncate(52.64,1) truncate(52.64,2) truncate(52.64,-1) truncate(52.64,-2)
+52.6 52.64 50 0
+round(5.5) round(-5.5)
+6 -6
+round(5.64,1) round(5.64,2) round(5.64,-1) round(5.64,-2)
+5.6 5.64 10 0
+abs(-10) sign(-5) sign(5) sign(0)
+10 -1 1 0
+log(exp(10)) exp(log(sqrt(10))*2)
+10.000000 10.000000
+pow(10,log10(10)) power(2,4)
+10.000000 16.000000
+rand(999999) rand()
+0.18435012473199 0.76373626176616
+PI() sin(pi()/2) cos(pi()/2) tan(pi()) cot(1) asin(1) acos(0) atan(1)
+3.141593 1.000000 0.000000 -0.000000 0.64209262 1.570796 1.570796 0.785398
+degrees(pi()) radians(360)
+180 6.2831853071796
diff --git a/mysql-test/r/func_misc.result b/mysql-test/r/func_misc.result
new file mode 100644
index 00000000000..5448127548b
--- /dev/null
+++ b/mysql-test/r/func_misc.result
@@ -0,0 +1,8 @@
+format(1.5555,0) format(123.5555,1) format(1234.5555,2) format(12345.5555,3) format(123456.5555,4) format(1234567.5555,5) format("12345.2399",2)
+2 123.6 1,234.56 12,345.556 123,456.5555 1,234,567.55550 12,345.24
+inet_ntoa(inet_aton("255.255.255.255.255.255.255.255"))
+255.255.255.255.255.255.255.255
+inet_aton("255.255.255.255.255") inet_aton("255.255.1.255") inet_aton("0.1.255")
+1099511627775 4294902271 511
+inet_ntoa(1099511627775) inet_ntoa(4294902271) inet_ntoa(511)
+255.255.255.255.255 255.255.1.255 0.0.1.255
diff --git a/mysql-test/r/func_op.result b/mysql-test/r/func_op.result
new file mode 100644
index 00000000000..b14f575c998
--- /dev/null
+++ b/mysql-test/r/func_op.result
@@ -0,0 +1,6 @@
+1+1 1-1 1+1*2 8/5 8%5 mod(8,5) mod(8,5)|0 -(1+1)*-2
+2 0 3 1.60 3 3 3 4
+1 | (1+1) 5 & 3 bit_count(7)
+3 1 3
+1 << 32 1 << 63 1 << 64 4 >> 2 4 >> 63 1<< 63 >> 60
+4294967296 -9223372036854775808 0 1 0 8
diff --git a/mysql-test/r/func_regexp.result b/mysql-test/r/func_regexp.result
new file mode 100644
index 00000000000..05b324d0c9e
--- /dev/null
+++ b/mysql-test/r/func_regexp.result
@@ -0,0 +1,15 @@
+s1 regexp s2
+1
+1
+1
+1
+1
+1
+1
+0
+0
+0
+NULL
+NULL
+NULL
+NULL
diff --git a/mysql-test/r/func_set.result b/mysql-test/r/func_set.result
new file mode 100644
index 00000000000..b82fffc3dbd
--- /dev/null
+++ b/mysql-test/r/func_set.result
@@ -0,0 +1,18 @@
+interval(55,10,20,30,40,50,60,70,80,90,100) interval(3,1,1+1,1+1+1+1) field("IBM","NCA","ICL","SUN","IBM","DIGITAL") field("A","B","C") elt(2,"ONE","TWO","THREE") interval(0,1,2,3,4) elt(1,1,2,3)|0 elt(1,1.1,1.2,1.3)+0
+5 2 4 0 TWO 0 1 1.1
+find_in_set("b","a,b,c") find_in_set("c","a,b,c") find_in_set("dd","a,bbb,dd") find_in_set("bbb","a,bbb,dd")
+2 3 3 2
+find_in_set("d","a,b,c") find_in_set("dd","a,bbb,d") find_in_set("bb","a,bbb,dd")
+0 0 0
+make_set(0,'a','b','c') make_set(-1,'a','b','c') make_set(1,'a','b','c') make_set(2,'a','b','c') make_set(1+2,concat('a','b'),'c')
+ a,b,c a b ab,c
+make_set(NULL,'a','b','c') make_set(1|4,'a',NULL,'c') make_set(1+2,'a',NULL,'c')
+NULL a,c a
+export_set(9,"Y","N","-",5) export_set(9,"Y","N") export_set(9,"Y","N","")
+Y-N-N-Y-N Y,N,N,Y,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N YNNYNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN
+elt(2,1) field(NULL,"a","b","c")
+NULL 0
+find_in_set("","a,b,c") find_in_set("","a,b,c,") find_in_set("",",a,b,c")
+0 4 1
+find_in_set("abc","abc") find_in_set("ab","abc") find_in_set("abcd","abc")
+1 0 0
diff --git a/mysql-test/r/strfunc.result b/mysql-test/r/func_str.result
index ac352d2ffb7..fbf3aad6636 100644
--- a/mysql-test/r/strfunc.result
+++ b/mysql-test/r/func_str.result
@@ -60,3 +60,40 @@ rpad('abcd',1,'ab') lpad('abcd',1,'ab')
a a
LEAST(NULL,'HARRY','HARRIOT',NULL,'HAROLD') GREATEST(NULL,'HARRY','HARRIOT',NULL,'HAROLD')
HAROLD HARRY
+least(1,2,3) | greatest(16,32,8) least(5,4)*1 greatest(-1.0,1.0)*1 least(3,2,1)*1.0 greatest(1,1.1,1.0) least("10",9) greatest("A","B","0")
+33 4 1.0 1.0 1.1 9 B
+decode(encode(repeat("a",100000),"monty"),"monty")=repeat("a",100000)
+1
+decode(encode("abcdef","monty"),"monty")="abcdef"
+1
+reverse("")
+
+insert("aa",100,1,"b") insert("aa",1,3,"b") left("aa",-1) substring("a",1,2)
+aa b a
+elt(2,1) field(NULL,"a","b","c") reverse("")
+NULL 0
+locate("a","b",2) locate("","a",1)
+0 1
+ltrim("a") rtrim("a") trim(BOTH "" from "a") trim(BOTH " " from "a")
+a a a a
+concat("1","2")|0 concat("1",".5")+0.0
+12 1.5
+substring_index("www.tcx.se","",3)
+
+length(repeat("a",100000000)) length(repeat("a",1000*64))
+NULL 64000
+position("0" in "baaa" in (1)) position("0" in "1" in (1,2,3)) position("sql" in ("mysql"))
+1 0 3
+position(("1" in (1,2,3)) in "01")
+2
+length(repeat("a",65500)) length(concat(repeat("a",32000),repeat("a",32000))) length(replace("aaaaa","a",concat(repeat("a",10000)))) length(insert(repeat("a",40000),1,30000,repeat("b",50000)))
+65500 64000 50000 60000
+length(repeat("a",1000000)) length(concat(repeat("a",32000),repeat("a",32000),repeat("a",32000))) length(replace("aaaaa","a",concat(repeat("a",32000)))) length(insert(repeat("a",48000),1,1000,repeat("a",48000)))
+1000000 96000 160000 95000
+Date Unix
+1998-9-16 09:26:00 905927160
+1998-9-16 09:26:00 905927160
+domain
+hello.de
+domain
+test.de
diff --git a/mysql-test/r/func_system.result b/mysql-test/r/func_system.result
new file mode 100644
index 00000000000..08719a2150b
--- /dev/null
+++ b/mysql-test/r/func_system.result
@@ -0,0 +1,4 @@
+database() user()
+test test@localhost
+version()>="3.23.29"
+1
diff --git a/mysql-test/r/func_test.result b/mysql-test/r/func_test.result
new file mode 100644
index 00000000000..3dc0fc19848
--- /dev/null
+++ b/mysql-test/r/func_test.result
@@ -0,0 +1,36 @@
+0=0 1>0 1>=1 1<0 1<=0 1!=0 strcmp("abc","abcd") strcmp("b","a") strcmp("a","a")
+1 1 1 0 0 1 -1 1 0
+"a"<"b" "a"<="b" "b">="a" "b">"a" "a"="A" "a"<>"b"
+1 1 1 1 1 1
+"a "="A" "A "="a" "a " <= "A b"
+1 1 1
+"abc" like "a%" "abc" not like "%d%" "a%" like "a\%" "abc%" like "a%\%" "abcd" like "a%b_%d" "a" like "%%a" "abcde" like "a%_e" "abc" like "abc%"
+1 1 1 1 1 1 1 1
+"a" like "%%b" "a" like "%%ab" "ab" like "a\%" "ab" like "_" "ab" like "ab_" "abc" like "%_d" "abc" like "abc%d"
+0 0 0 0 0 0 0
+'?' like '|%' '?' like '|%' ESCAPE '|' '%' like '|%' '%' like '|%' ESCAPE '|' '%' like '%'
+0 0 0 1 1
+'abc' like '%c' 'abcabc' like '%c' "ab" like "" "ab" like "a" "ab" like "ab"
+1 1 0 0 1
+"Det här är svenska" regexp "h[[:alpha:]]+r" "aba" regexp "^(a|b)*$"
+1 1
+"aba" regexp concat("^","a")
+1
+!0 NOT 0=1 !(0=0) 1 AND 1 1 && 0 0 OR 1 1 || NULL 1=1 or 1=1 and 1=0
+1 1 0 1 0 1 1 1
+IF(0,"ERROR","this") IF(1,"is","ERROR") IF(NULL,"ERROR","a") IF(1,2,3)|0 IF(1,2.0,3.0)+0
+this is a 2 2.0
+2 between 1 and 3 "monty" between "max" and "my" 2=2 and "monty" between "max" and "my" and 3=3
+1 1 1
+'b' between 'a' and 'c' 'B' between 'a' and 'c'
+1 1
+2 in (3,2,5,9,5,1) "monty" in ("david","monty","allan") 1.2 in (1.4,1.2,1.0)
+1 1 1
+-1.49 or -1.49 0.6 or 0.6
+1 1
+5 between 0 and 10 between 0 and 1 (5 between 0 and 10) between 0 and 1
+0 1
+1 and 2 between 2 and 10 2 between 2 and 10 and 1
+1 1
+1 and 0 or 2 2 or 1 and 0
+1 1
diff --git a/mysql-test/r/func_time.result b/mysql-test/r/func_time.result
new file mode 100644
index 00000000000..c132c7dba8e
--- /dev/null
+++ b/mysql-test/r/func_time.result
@@ -0,0 +1,186 @@
+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
+period_add("9602",-12) period_diff(199505,"9404")
+199502 13
+now()-now() weekday(curdate())-weekday(now()) unix_timestamp()-unix_timestamp(now())
+0 0 0
+from_unixtime(unix_timestamp("1994-03-02 10:11:12")) from_unixtime(unix_timestamp("1994-03-02 10:11:12"),"%Y-%m-%d %h:%i:%s") from_unixtime(unix_timestamp("1994-03-02 10:11:12"))+0
+1994-03-02 10:11:12 1994-03-02 10:11:12 19940302101112
+sec_to_time(9001) sec_to_time(9001)+0 time_to_sec("15:12:22")
+02:30:01 23001 54742
+now()-curdate()*1000000-curtime()
+0
+strcmp(current_timestamp(),concat(current_date()," ",current_time()))
+0
+date_format("1997-01-02 03:04:05", "%M %W %D %Y %y %m %d %h %i %s %w")
+January Thursday 2nd 1997 97 01 02 03 04 05 4
+date_format("1997-01-02", concat("%M %W %D ","%Y %y %m %d %h %i %s %w"))
+January Thursday 2nd 1997 97 01 02 12 00 00 4
+dayofmonth("1997-01-02") dayofmonth(19970323)
+2 23
+month("1997-01-02") year("98-02-03") dayofyear("1997-12-31")
+1 1998 365
+DAYOFYEAR("1997-03-03") WEEK("1998-03-03") QUARTER(980303)
+62 9 1
+HOUR("1997-03-03 23:03:22") MINUTE("23:03:22") SECOND(230322)
+23 3 22
+week(19980101) week(19970101) week(19980101,1) week(19970101,1)
+0 1 1 1
+week(19981231) week(19971231) week(19981231,1) week(19971231,1)
+52 53 53 53
+week(19950101) week(19950101,1)
+1 0
+yearweek('1981-12-31',1) yearweek('1982-01-01',1) yearweek('1982-12-31',1) yearweek('1983-01-01',1)
+198153 198153 198252 198252
+date_format('1998-12-31','%x-%v') date_format('1999-01-01','%x-%v')
+1998-53 1998-53
+date_format('1999-12-31','%x-%v') date_format('2000-01-01','%x-%v')
+1999-52 1999-52
+yearweek('1987-01-01',1) yearweek('1987-01-01')
+198701 198653
+dayname("1962-03-03") dayname("1962-03-03")+0
+Saturday 5
+monthname("1972-03-04") monthname("1972-03-04")+0
+March 3
+time_format(19980131000000,'%H|%I|%k|%l|%i|%p|%r|%S|%T')
+00|12|0|12|00|AM|12:00:00 AM|00|00:00:00
+time_format(19980131010203,'%H|%I|%k|%l|%i|%p|%r|%S|%T')
+01|01|1|1|02|AM|01:02:03 AM|03|01:02:03
+time_format(19980131131415,'%H|%I|%k|%l|%i|%p|%r|%S|%T')
+13|01|13|1|14|PM|01:14:15 PM|15|13:14:15
+time_format(19980131010015,'%H|%I|%k|%l|%i|%p|%r|%S|%T')
+01|01|1|1|00|AM|01:00:15 AM|15|01:00:15
+date_format(concat('19980131',131415),'%H|%I|%k|%l|%i|%p|%r|%S|%T| %M|%W|%D|%Y|%y|%a|%b|%j|%m|%d|%h|%s|%w')
+13|01|13|1|14|PM|01:14:15 PM|15|13:14:15| January|Saturday|31st|1998|98|Sat|Jan|031|01|31|01|15|6
+date_format(19980021000000,'%H|%I|%k|%l|%i|%p|%r|%S|%T| %M|%W|%D|%Y|%y|%a|%b|%j|%m|%d|%h|%s|%w')
+NULL
+date_add("1997-12-31 23:59:59",INTERVAL 1 SECOND)
+1998-01-01 00:00:00
+date_add("1997-12-31 23:59:59",INTERVAL 1 MINUTE)
+1998-01-01 00:00:59
+date_add("1997-12-31 23:59:59",INTERVAL 1 HOUR)
+1998-01-01 00:59:59
+date_add("1997-12-31 23:59:59",INTERVAL 1 DAY)
+1998-01-01 23:59:59
+date_add("1997-12-31 23:59:59",INTERVAL 1 MONTH)
+1998-01-31 23:59:59
+date_add("1997-12-31 23:59:59",INTERVAL 1 YEAR)
+1998-12-31 23:59:59
+date_add("1997-12-31 23:59:59",INTERVAL "1:1" MINUTE_SECOND)
+1998-01-01 00:01:00
+date_add("1997-12-31 23:59:59",INTERVAL "1:1" HOUR_MINUTE)
+1998-01-01 01:00:59
+date_add("1997-12-31 23:59:59",INTERVAL "1:1" DAY_HOUR)
+1998-01-02 00:59:59
+date_add("1997-12-31 23:59:59",INTERVAL "1 1" YEAR_MONTH)
+1999-01-31 23:59:59
+date_add("1997-12-31 23:59:59",INTERVAL "1:1:1" HOUR_SECOND)
+1998-01-01 01:01:00
+date_add("1997-12-31 23:59:59",INTERVAL "1 1:1" DAY_MINUTE)
+1998-01-02 01:00:59
+date_add("1997-12-31 23:59:59",INTERVAL "1 1:1:1" DAY_SECOND)
+1998-01-02 01:01:00
+date_sub("1998-01-01 00:00:00",INTERVAL 1 SECOND)
+1997-12-31 23:59:59
+date_sub("1998-01-01 00:00:00",INTERVAL 1 MINUTE)
+1997-12-31 23:59:00
+date_sub("1998-01-01 00:00:00",INTERVAL 1 HOUR)
+1997-12-31 23:00:00
+date_sub("1998-01-01 00:00:00",INTERVAL 1 DAY)
+1997-12-31 00:00:00
+date_sub("1998-01-01 00:00:00",INTERVAL 1 MONTH)
+1997-12-01 00:00:00
+date_sub("1998-01-01 00:00:00",INTERVAL 1 YEAR)
+1997-01-01 00:00:00
+date_sub("1998-01-01 00:00:00",INTERVAL "1:1" MINUTE_SECOND)
+1997-12-31 23:58:59
+date_sub("1998-01-01 00:00:00",INTERVAL "1:1" HOUR_MINUTE)
+1997-12-31 22:59:00
+date_sub("1998-01-01 00:00:00",INTERVAL "1:1" DAY_HOUR)
+1997-12-30 23:00:00
+date_sub("1998-01-01 00:00:00",INTERVAL "1 1" YEAR_MONTH)
+1996-12-01 00:00:00
+date_sub("1998-01-01 00:00:00",INTERVAL "1:1:1" HOUR_SECOND)
+1997-12-31 22:58:59
+date_sub("1998-01-01 00:00:00",INTERVAL "1 1:1" DAY_MINUTE)
+1997-12-30 22:59:00
+date_sub("1998-01-01 00:00:00",INTERVAL "1 1:1:1" DAY_SECOND)
+1997-12-30 22:58:59
+date_add("1997-12-31 23:59:59",INTERVAL 100000 SECOND)
+1998-01-02 03:46:39
+date_add("1997-12-31 23:59:59",INTERVAL -100000 MINUTE)
+1997-10-23 13:19:59
+date_add("1997-12-31 23:59:59",INTERVAL 100000 HOUR)
+2009-05-29 15:59:59
+date_add("1997-12-31 23:59:59",INTERVAL -100000 DAY)
+1724-03-17 23:59:59
+date_add("1997-12-31 23:59:59",INTERVAL 100000 MONTH)
+NULL
+date_add("1997-12-31 23:59:59",INTERVAL -100000 YEAR)
+NULL
+date_add("1997-12-31 23:59:59",INTERVAL "10000:1" MINUTE_SECOND)
+1998-01-07 22:40:00
+date_add("1997-12-31 23:59:59",INTERVAL "-10000:1" HOUR_MINUTE)
+1996-11-10 07:58:59
+date_add("1997-12-31 23:59:59",INTERVAL "10000:1" DAY_HOUR)
+2025-05-19 00:59:59
+date_add("1997-12-31 23:59:59",INTERVAL "-100 1" YEAR_MONTH)
+1897-11-30 23:59:59
+date_add("1997-12-31 23:59:59",INTERVAL "10000:99:99" HOUR_SECOND)
+1999-02-21 17:40:38
+date_add("1997-12-31 23:59:59",INTERVAL " -10000 99:99" DAY_MINUTE)
+1970-08-11 19:20:59
+date_add("1997-12-31 23:59:59",INTERVAL "10000 99:99:99" DAY_SECOND)
+2025-05-23 04:40:38
+"1997-12-31 23:59:59" + INTERVAL 1 SECOND
+1998-01-01 00:00:00
+INTERVAL 1 DAY + "1997-12-31"
+1998-01-01
+"1998-01-01 00:00:00" - INTERVAL 1 SECOND
+1997-12-31 23:59:59
+date_sub("1998-01-02",INTERVAL 31 DAY)
+1997-12-02
+date_add("1997-12-31",INTERVAL 1 SECOND)
+1997-12-31 00:00:01
+date_add("1997-12-31",INTERVAL 1 DAY)
+1998-01-01
+date_add(NULL,INTERVAL 100000 SECOND)
+NULL
+date_add("1997-12-31 23:59:59",INTERVAL NULL SECOND)
+NULL
+date_add("1997-12-31 23:59:59",INTERVAL NULL MINUTE_SECOND)
+NULL
+date_add("9999-12-31 23:59:59",INTERVAL 1 SECOND)
+NULL
+date_sub("0000-00-00 00:00:00",INTERVAL 1 SECOND)
+NULL
+date_add('1998-01-30',Interval 1 month)
+1998-02-28
+date_add('1998-01-30',Interval '2:1' year_month)
+2000-02-29
+date_add('1996-02-29',Interval '1' year)
+1997-02-28
+extract(YEAR FROM "1999-01-02 10:11:12")
+1999
+extract(YEAR_MONTH FROM "1999-01-02")
+199901
+extract(DAY FROM "1999-01-02")
+2
+extract(DAY_HOUR FROM "1999-01-02 10:11:12")
+210
+extract(DAY_MINUTE FROM "02 10:11:12")
+21011
+extract(DAY_SECOND FROM "225 10:11:12")
+225101112
+extract(HOUR FROM "1999-01-02 10:11:12")
+10
+extract(HOUR_MINUTE FROM "10:11:12")
+1011
+extract(HOUR_SECOND FROM "10:11:12")
+101112
+extract(MINUTE FROM "10:11:12")
+11
+extract(MINUTE_SECOND FROM "10:11:12")
+1112
+extract(SECOND FROM "1999-01-02 10:11:12")
+12
diff --git a/mysql-test/r/group_by.result b/mysql-test/r/group_by.result
new file mode 100644
index 00000000000..ced1a3cd178
--- /dev/null
+++ b/mysql-test/r/group_by.result
@@ -0,0 +1,32 @@
+userid MIN(t1.score)
+1 1
+2 2
+3 3
+userid MIN(t1.score)
+1 1
+2 2
+userid MIN(t1.score+0.0)
+1 1.0
+2 2.0
+cid CONCAT(firstname, ' ', surname) COUNT(call_id)
+cid CONCAT(firstname, ' ', surname) COUNT(call_id)
+value description bug_id
+BBBBBBBBBBBBB - conversion 9
+BBBBBBBBBBBBB - conversion 10
+BBBBBBBBBBBBB - generic 7
+BBBBBBBBBBBBB - generic 14
+BBBBBBBBBBBBB - eeeeeeeee NULL
+kkkkkkkkkkk lllllllllll 6
+kkkkkkkkkkk lllllllllll 8
+kkkkkkkkkkk lllllllllll 12
+Test Procedures NULL
+Documentation NULL
+Host communication NULL
+value description COUNT(bug_id)
+BBBBBBBBBBBBB - conversion 2
+BBBBBBBBBBBBB - eeeeeeeee 0
+BBBBBBBBBBBBB - generic 2
+Documentation 0
+Host communication 0
+kkkkkkkkkkk lllllllllll 3
+Test Procedures 0
diff --git a/mysql-test/r/have_bdb.require b/mysql-test/r/have_bdb.require
new file mode 100644
index 00000000000..969cd6863db
--- /dev/null
+++ b/mysql-test/r/have_bdb.require
@@ -0,0 +1,2 @@
+Variable_name Value
+have_bdb YES
diff --git a/mysql-test/r/have_isam.require b/mysql-test/r/have_isam.require
new file mode 100644
index 00000000000..9b4142361ed
--- /dev/null
+++ b/mysql-test/r/have_isam.require
@@ -0,0 +1,2 @@
+Variable_name Value
+have_isam YES
diff --git a/mysql-test/r/have_raid.require b/mysql-test/r/have_raid.require
new file mode 100644
index 00000000000..8390f4dbb85
--- /dev/null
+++ b/mysql-test/r/have_raid.require
@@ -0,0 +1,2 @@
+Variable_name Value
+have_raid YES
diff --git a/mysql-test/r/heap.result b/mysql-test/r/heap.result
new file mode 100644
index 00000000000..1bf34c6ad1b
--- /dev/null
+++ b/mysql-test/r/heap.result
@@ -0,0 +1,80 @@
+Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Comment
+t1 0 PRIMARY 1 a NULL NULL NULL NULL
+a b
+2 2
+3 3
+4 4
+a b
+4 4
+a b
+2 2
+3 3
+4 6
+a b
+1 1
+2 2
+3 3
+4 4
+a
+869751
+802616
+a
+869751
+802616
+a
+736494
+a
+736494
+869751
+a
+226312
+736494
+802616
+869751
+table type possible_keys key key_len ref rows Extra
+t1 range uniq_id uniq_id 4 NULL 4 where used; Using index
+x y
+1 3
+1 1
+x y x y
+1 1 1 1
+2 2 2 2
+1 3 1 1
+2 4 2 2
+2 5 2 2
+2 6 2 2
+table type possible_keys key key_len ref rows Extra
+t1 ALL x NULL NULL NULL 6
+t2 eq_ref y y 4 t1.x 1
+max(a)
+1
+a b
+1 6
+1 5
+1 4
+1 3
+1 2
+1 1
+a b
+1 6
+1 5
+1 4
+1 3
+1 2
+1 1
+1 6
+1 5
+1 4
+1 3
+1 2
+1 1
+max(id)
+1
+max(id)
+2
+f1 f2
+16 ted
+12 ted
+12 ted
+12 ted
+12 ted
diff --git a/mysql-test/r/ins000001.result b/mysql-test/r/ins000001.result
index 1003b3b6b18..283f31ffb43 100644
--- a/mysql-test/r/ins000001.result
+++ b/mysql-test/r/ins000001.result
@@ -1,4 +1,4 @@
-id domain
-1 mysql.com
-2 hotmail.com
-3 aol.com
+id t2
+1 mysql.com
+2 hotmail.com
+3 aol.com
diff --git a/mysql-test/r/insert.result b/mysql-test/r/insert.result
new file mode 100644
index 00000000000..145ec8a5cf4
--- /dev/null
+++ b/mysql-test/r/insert.result
@@ -0,0 +1,6 @@
+a
+1
+2
+3
+4
+5
diff --git a/mysql-test/r/insert_select.result b/mysql-test/r/insert_select.result
new file mode 100644
index 00000000000..c754085ccb3
--- /dev/null
+++ b/mysql-test/r/insert_select.result
@@ -0,0 +1,13 @@
+payoutID
+1
+4
+6
+9
+10
+11
+12
+14
+16
+19
+20
+22
diff --git a/mysql-test/r/join.result b/mysql-test/r/join.result
new file mode 100644
index 00000000000..00285c57a7e
--- /dev/null
+++ b/mysql-test/r/join.result
@@ -0,0 +1,9 @@
+id id
+107 107
+75 75
+id count(t2.id)
+75 1
+107 1
+id count(t2.id)
+75 1
+107 1
diff --git a/mysql-test/r/join_outer.result b/mysql-test/r/join_outer.result
new file mode 100644
index 00000000000..ceca80dd5ae
--- /dev/null
+++ b/mysql-test/r/join_outer.result
@@ -0,0 +1,315 @@
+grp a c id a c d
+1 1 a 1 1 a 1
+3 4 E 3 4 A 4
+3 5 C 3 5 B 5
+3 6 D 3 6 C 6
+grp a c id a c d
+NULL NULL NULL NULL NULL NULL
+1 1 a 1 1 a 1
+2 2 b NULL NULL NULL NULL
+2 3 c NULL NULL NULL NULL
+3 4 E 3 4 A 4
+3 5 C 3 5 B 5
+3 6 D 3 6 C 6
+grp a c id a c d
+1 1 a 1 1 a 1
+3 4 E 3 4 A 4
+3 5 C 3 5 B 5
+3 6 D 3 6 C 6
+NULL NULL NULL 4 7 D 7
+grp a c id a c d
+1 1 a 1 1 a 1
+3 4 E 3 4 A 4
+3 5 C 3 5 B 5
+3 6 D 3 6 C 6
+NULL NULL NULL 4 7 D 7
+grp a c id a c d
+1 1 a 1 1 a 1
+2 2 b NULL NULL NULL NULL
+2 3 c NULL NULL NULL NULL
+3 4 E 3 4 A 4
+3 5 C 3 5 B 5
+3 6 D 3 6 C 6
+NULL NULL NULL NULL NULL NULL
+grp a c id a c d
+1 1 a 1 1 a 1
+2 2 b NULL NULL NULL NULL
+2 3 c NULL NULL NULL NULL
+3 4 E NULL NULL NULL NULL
+3 5 C NULL NULL NULL NULL
+3 6 D NULL NULL NULL NULL
+NULL NULL NULL NULL NULL NULL
+grp a c id a c d
+1 1 a 1 1 a 1
+1 1 a 3 4 A 4
+2 2 b 3 5 B 5
+2 3 c 3 6 C 6
+3 4 E NULL NULL NULL NULL
+3 5 C 3 6 C 6
+3 6 D 4 7 D 7
+NULL NULL NULL NULL NULL NULL
+grp a c id a c d
+1 1 a 1 1 a 1
+2 2 b NULL NULL NULL NULL
+2 3 c NULL NULL NULL NULL
+3 4 E NULL NULL NULL NULL
+3 5 C NULL NULL NULL NULL
+3 6 D NULL NULL NULL NULL
+NULL NULL NULL NULL NULL NULL
+grp a c id a c d
+3 4 E 3 4 A 4
+3 5 C 3 5 B 5
+3 6 D 3 6 C 6
+grp a c id a c d
+2 2 b NULL NULL NULL NULL
+2 3 c NULL NULL NULL NULL
+NULL NULL NULL NULL NULL NULL
+Comment
+Impossible WHERE noticed after reading const tables
+table type possible_keys key key_len ref rows Extra
+t1 ALL NULL NULL NULL NULL 7
+t2 eq_ref PRIMARY PRIMARY 8 t1.a 1 where used
+grp a c id a c d a
+1 1 a 1 1 a 1 1
+2 2 b NULL NULL NULL NULL NULL
+2 3 c NULL NULL NULL NULL NULL
+3 4 E 3 4 A 4 4
+3 5 C 3 5 B 5 5
+3 6 D 3 6 C 6 6
+NULL NULL NULL NULL NULL NULL NULL
+grp a c id a c d
+1 1 a 1 1 a 1
+3 4 E 3 4 A 4
+3 5 C 3 5 B 5
+3 6 D 3 6 C 6
+grp a c id a c d
+1 1 a 1 1 a 1
+3 4 E 3 4 A 4
+3 5 C 3 5 B 5
+3 6 D 3 6 C 6
+grp a c id a c d
+1 1 a 1 1 a 1
+usr_id uniq_id increment usr2_id c_amount max
+3 4 84676 NULL NULL NULL
+usr_id uniq_id increment usr2_id c_amount max
+3 4 84676 NULL NULL NULL
+usr_id uniq_id increment usr2_id c_amount max
+3 4 84676 NULL NULL NULL
+usr_id uniq_id increment usr2_id c_amount max
+3 4 84676 NULL NULL NULL
+usr_id uniq_id increment usr2_id c_amount max
+3 4 84676 NULL NULL NULL
+fill desc_larga_cat cred_total Grup Places PlacesOcupades
+10360 asdfggfg 6.0 0 55 0
+10360 asdfggfg 6.0 12 333 0
+10360 asdfggfg 6.0 33 8 0
+10360 asdfggfg 6.0 45 10 0
+10360 asdfggfg 6.0 55 2 0
+10360 asdfggfg 6.0 7887 85 0
+10360 asdfggfg 6.0 32767 7 0
+10361 Components i Circuits Electronics I 6.0 30 2 0
+10361 Components i Circuits Electronics I 6.0 40 3 0
+10362 Laboratori d`Ordinadors 4.5 10 12 0
+10362 Laboratori d`Ordinadors 4.5 11 111 0
+fill idPla
+10360 NULL
+10361 NULL
+10362 NULL
+fill idPla
+10360 1
+10361 NULL
+10362 NULL
+name name id
+Antonio Paz El Gato 1
+Antonio Paz Perrito 2
+Lilliana Angelovska NULL NULL
+Thimble Smith Happy 3
+name name id
+Lilliana Angelovska NULL NULL
+table type possible_keys key key_len ref rows Extra
+t1 ALL NULL NULL NULL NULL 3
+t2 ALL NULL NULL NULL NULL 3 where used; Not exists
+table type possible_keys key key_len ref rows Extra
+t1 ALL NULL NULL NULL NULL 3
+t2 ALL NULL NULL NULL NULL 3 where used
+count(*)
+4
+name name id
+Antonio Paz El Gato 1
+Antonio Paz Perrito 2
+Lilliana Angelovska NULL NULL
+Thimble Smith Happy 3
+name name id
+Lilliana Angelovska NULL NULL
+table type possible_keys key key_len ref rows Extra
+t1 ALL NULL NULL NULL NULL 3
+t2 ALL NULL NULL NULL NULL 3 where used; Not exists
+table type possible_keys key key_len ref rows Extra
+t1 ALL NULL NULL NULL NULL 3
+t2 ALL NULL NULL NULL NULL 3 where used
+count(*)
+4
+name name id id
+Antonio Paz El Gato 1 1
+Antonio Paz Perrito 2 1
+Lilliana Angelovska NULL NULL NULL
+Thimble Smith Happy 3 3
+name name id id
+Antonio Paz El Gato 1 1
+Antonio Paz Perrito 2 1
+NULL Happy 3 1
+NULL El Gato 1 2
+NULL Perrito 2 2
+NULL Happy 3 2
+NULL El Gato 1 3
+NULL Perrito 2 3
+Thimble Smith Happy 3 3
+name name id owner id
+Antonio Paz El Gato 1 1 1
+Antonio Paz Perrito 2 1 1
+Lilliana Angelovska NULL NULL NULL 1
+Thimble Smith NULL NULL NULL 1
+Antonio Paz NULL NULL NULL 2
+Lilliana Angelovska NULL NULL NULL 2
+Thimble Smith NULL NULL NULL 2
+Antonio Paz NULL NULL NULL 3
+Lilliana Angelovska NULL NULL NULL 3
+Thimble Smith Happy 3 3 3
+id str
+4 bar
+3 foo
+id str
+1 NULL
+2 NULL
+n m o n m o
+1 2 11 1 2 3
+1 2 7 1 2 3
+1 2 9 1 2 3
+1 3 9 NULL NULL NULL
+n m o n m o
+1 2 7 1 2 3
+1 2 9 1 2 3
+1 3 9 NULL NULL NULL
+1 2 11 1 2 3
+id2
+3
+id2
+3
+color name
+red apple
+yellow banana
+green lime
+black grape
+blue blueberry
+count color
+10 green
+5 black
+15 white
+7 green
+count color color name
+10 green green lime
+7 green green lime
+5 black black grape
+count name
+10 lime
+7 lime
+5 grape
+count name
+10 lime
+7 lime
+5 grape
+pcode count
+kld2000 1
+klw1000 0
+klw1020 0
+klw1500 0
+klw2000 0
+klw2001 0
+klw2002 0
+klw2500 0
+kmw1000 0
+kmw1500 0
+kmw2000 0
+kmw2001 0
+kmw2100 0
+kmw3000 0
+kmw3200 0
+kvw2000 26
+kvw2001 0
+kvw3000 36
+kvw3001 0
+kvw3002 0
+kvw3500 26
+kvw3501 0
+kvw3502 0
+kvw3800 0
+kvw3801 0
+kvw3802 0
+kvw3900 0
+kvw3901 0
+kvw3902 0
+kvw4000 0
+kvw4001 0
+kvw4002 0
+kvw4200 0
+kvw4500 0
+kvw5000 0
+kvw5001 0
+kvw5500 0
+kvw5510 0
+kvw5600 0
+kvw5601 0
+kvw6000 2
+pcode count
+kld2000 1
+klw1000 0
+klw1020 0
+klw1500 0
+klw2000 0
+klw2001 0
+klw2002 0
+klw2500 0
+kmw1000 0
+kmw1500 0
+kmw2000 0
+kmw2001 0
+kmw2100 0
+kmw3000 0
+kmw3200 0
+kvw2000 26
+kvw2001 0
+kvw3000 36
+kvw3001 0
+kvw3002 0
+kvw3500 26
+kvw3501 0
+kvw3502 0
+kvw3800 0
+kvw3801 0
+kvw3802 0
+kvw3900 0
+kvw3901 0
+kvw3902 0
+kvw4000 0
+kvw4001 0
+kvw4002 0
+kvw4200 0
+kvw4500 0
+kvw5000 0
+kvw5001 0
+kvw5500 0
+kvw5510 0
+kvw5600 0
+kvw5601 0
+kvw6000 2
+id pid rep_del id pid rep_del
+1 NULL NULL 2 1 NULL
+2 1 NULL NULL NULL NULL
+id pid rep_del id pid rep_del
+1 NULL NULL 2 1 NULL
+2 1 NULL NULL NULL NULL
+table type possible_keys key key_len ref rows Extra
+t1 ALL NULL NULL NULL NULL 2
+t2 index id id 8 NULL 1 where used; Using index; Not exists
+id name id idx
+2 no NULL NULL
diff --git a/mysql-test/r/key.result b/mysql-test/r/key.result
new file mode 100644
index 00000000000..22c30c975f0
--- /dev/null
+++ b/mysql-test/r/key.result
@@ -0,0 +1,12 @@
+value
+personal employee company
+price area type transityes shopsyes schoolsyes petsyes
+name author category email password proxy bitmap msg urlscol urlhttp timeout nbcnx creation livinguntil lang type subcat subtype reg scs capacity userISP CCident
+patnom patauteur 0 p.favre@cryo-networks.fr NULL NULL #p2sndnq6ae5g1u6t essai
+salut scol://195.242.78.119:patauteur.patnom NULL NULL NULL 950036174 -882087474 NULL 3 0 3 1 Pub/patnom/futur_divers.scs NULL pat CC1
+name_id name
+name_id name
+2 [T,U]_axpby
+name_id name
+name_id name
+2 [T,U]_axpby
diff --git a/mysql-test/r/key_diff.result b/mysql-test/r/key_diff.result
new file mode 100644
index 00000000000..ab5b9bcc0e7
--- /dev/null
+++ b/mysql-test/r/key_diff.result
@@ -0,0 +1,39 @@
+a b a b
+A B A B
+b A A B
+C c A B
+D E A B
+a a A B
+A B b A
+b A b A
+C c b A
+D E b A
+a a b A
+A B C c
+b A C c
+C c C c
+D E C c
+a a C c
+A B D E
+b A D E
+C c D E
+D E D E
+a a D E
+A B a a
+b A a a
+C c a a
+D E a a
+a a a a
+table type possible_keys key key_len ref rows Extra
+t1 ALL a NULL NULL NULL 5
+t2 ALL b NULL NULL NULL 5 where used
+a b a b
+A B a a
+A B b A
+C c C c
+a a a a
+a a b A
+b A A B
+a b
+A B
+a a
diff --git a/mysql-test/r/key_primary.result b/mysql-test/r/key_primary.result
new file mode 100644
index 00000000000..ee0c1c957dc
--- /dev/null
+++ b/mysql-test/r/key_primary.result
@@ -0,0 +1,9 @@
+t1
+ABC
+t1
+t1
+AB%
+table type possible_keys key key_len ref rows Extra
+t1 const PRIMARY PRIMARY 3 const 1
+Comment
+Impossible WHERE noticed after reading const tables
diff --git a/mysql-test/r/keywords.result b/mysql-test/r/keywords.result
new file mode 100644
index 00000000000..f49681ad93b
--- /dev/null
+++ b/mysql-test/r/keywords.result
@@ -0,0 +1,4 @@
+time date timestamp
+12:22:22 1997-02-03 19970102000000
+t1.time+0 t1.date+0 t1.timestamp+0 concat(date," ",time)
+122222 19970203 19970102000000 1997-02-03 12:22:22
diff --git a/mysql-test/r/limit.result b/mysql-test/r/limit.result
new file mode 100644
index 00000000000..0f5586e3b31
--- /dev/null
+++ b/mysql-test/r/limit.result
@@ -0,0 +1,22 @@
+a b
+0 0
+4 1
+2 1
+3 1
+a b
+0 0
+4 2
+2 2
+3 1
+a b
+0 0
+4 2
+2 2
+3 4
+a b
+0 0
+2 2
+3 4
+a b
+2 2
+3 4
diff --git a/mysql-test/r/merge.result b/mysql-test/r/merge.result
new file mode 100644
index 00000000000..5135ce0c9e9
--- /dev/null
+++ b/mysql-test/r/merge.result
@@ -0,0 +1,109 @@
+a b
+1 Testing
+2 table
+3 t1
+1 Testing
+2 table
+3 t2
+a b
+3 t1
+3 t2
+2 table
+2 table
+1 Testing
+1 Testing
+table type possible_keys key key_len ref rows Extra
+t3 range a a 4 NULL 10 where used
+table type possible_keys key key_len ref rows Extra
+t3 range a a 4 NULL 10 where used
+a b
+10 Testing
+10 Testing
+a b
+1 Testing
+1 Testing
+2 table
+2 table
+3 t1
+3 t2
+4 Testing
+4 Testing
+5 table
+5 table
+6 t1
+6 t2
+7 Testing
+7 Testing
+8 table
+8 table
+9 t2
+9 t2
+a b
+11 table
+11 table
+12 t1
+12 t1
+13 Testing
+13 Testing
+14 table
+14 table
+15 t2
+15 t2
+16 Testing
+16 Testing
+17 table
+17 table
+18 t2
+18 t2
+19 Testing
+19 Testing
+table type possible_keys key key_len ref rows Extra
+t3 index NULL a 4 NULL 1131 Using index
+a
+699
+698
+697
+696
+695
+694
+693
+692
+691
+690
+a
+416
+415
+415
+414
+414
+413
+413
+412
+412
+411
+c
+test1
+test1
+test1
+test2
+test2
+test2
+c
+test1
+test1
+test1
+test2
+test2
+test2
+c
+c
+test1
+test1
+test1
+incr othr
+incr othr
+1 10
+2 24
+4 33
+3 53
+c
diff --git a/mysql-test/r/mrg000001.dummy.result b/mysql-test/r/mrg000001.dummy.result
deleted file mode 100644
index 767f92bc2cb..00000000000
--- a/mysql-test/r/mrg000001.dummy.result
+++ /dev/null
@@ -1 +0,0 @@
-incr othr
diff --git a/mysql-test/r/mrg000001.result b/mysql-test/r/mrg000001.result
deleted file mode 100644
index 8b351ebe780..00000000000
--- a/mysql-test/r/mrg000001.result
+++ /dev/null
@@ -1,5 +0,0 @@
-incr othr
-1 10
-2 24
-4 33
-3 53
diff --git a/mysql-test/r/mrg000002.result b/mysql-test/r/mrg000002.result
deleted file mode 100644
index b4960c74ae6..00000000000
--- a/mysql-test/r/mrg000002.result
+++ /dev/null
@@ -1 +0,0 @@
-c
diff --git a/mysql-test/r/null.result b/mysql-test/r/null.result
new file mode 100644
index 00000000000..6109456b8c0
--- /dev/null
+++ b/mysql-test/r/null.result
@@ -0,0 +1,25 @@
+NULL NULL isnull(null) isnull(1/0) isnull(1/0 = null) ifnull(null,1) ifnull(null,"TRUE") ifnull("TRUE","ERROR") 1/0 is null 1 is not null
+NULL NULL 1 1 1 1 TRUE TRUE 1 1
+1 | NULL 1 & NULL 1+NULL 1-NULL
+NULL NULL NULL NULL
+NULL=NULL NULL<>NULL IFNULL(NULL,1.1)+0 IFNULL(NULL,1) | 0
+NULL NULL 1.1 1
+strcmp("a",NULL) (1<NULL)+0.0 NULL regexp "a" null like "a%" "a%" like null
+NULL NULL NULL NULL NULL
+concat("a",NULL) replace(NULL,"a","b") replace("string","i",NULL) replace("string",NULL,"i") insert("abc",1,1,NULL) left(NULL,1)
+NULL NULL NULL NULL NULL NULL
+repeat("a",0) repeat("ab",5+5) repeat("ab",-1) reverse(NULL)
+ abababababababababab NULL
+field(NULL,"a","b","c")
+0
+2 between null and 1 2 between 3 AND NULL NULL between 1 and 2 2 between NULL and 3 2 between 1 AND null
+0 0 NULL NULL NULL
+NULL AND NULL 1 AND NULL NULL AND 1 NULL OR NULL 0 OR NULL NULL OR 0
+NULL NULL NULL NULL NULL NULL
+(NULL OR NULL) IS NULL
+1
+NULL AND 0 0 and NULL
+NULL 0
+inet_ntoa(null) inet_aton(null) inet_aton("122.256") inet_aton("122.226.") inet_aton("")
+NULL NULL NULL NULL NULL
+x
diff --git a/mysql-test/r/null_key.result b/mysql-test/r/null_key.result
new file mode 100644
index 00000000000..6357f0b4682
--- /dev/null
+++ b/mysql-test/r/null_key.result
@@ -0,0 +1,94 @@
+table type possible_keys key key_len ref rows Extra
+t1 ref a a 5 const 3 where used; Using index
+table type possible_keys key key_len ref rows Extra
+t1 ref a,b a 9 const,const 1 where used; Using index
+table type possible_keys key key_len ref rows Extra
+t1 ref a,b a 9 const,const 1 where used; Using index
+table type possible_keys key key_len ref rows Extra
+t1 const a,b a 9 const,const 1
+table type possible_keys key key_len ref rows Extra
+t1 index NULL a 8 NULL 12 where used; Using index
+table type possible_keys key key_len ref rows Extra
+t1 range a,b a 9 NULL 3 where used; Using index
+table type possible_keys key key_len ref rows Extra
+t1 ref a,b b 4 const 2 where used
+table type possible_keys key key_len ref rows Extra
+t1 ref a,b a 5 const 3 where used; Using index
+table type possible_keys key key_len ref rows Extra
+t1 range a,b a 9 NULL 2 where used; Using index
+table type possible_keys key key_len ref rows Extra
+t1 range a a 5 NULL 1 where used; Using index
+table type possible_keys key key_len ref rows Extra
+t1 range a a 5 NULL 1 where used; Using index
+a b
+NULL 7
+NULL 9
+NULL 9
+a b
+NULL 7
+a b
+1 1
+2 2
+a b
+1 1
+2 2
+a b
+NULL 9
+NULL 9
+a b
+NULL 7
+7 7
+a b
+NULL 7
+NULL 9
+NULL 9
+table type possible_keys key key_len ref rows Extra
+t1 ref a,b a 5 const 3 where used
+table type possible_keys key key_len ref rows Extra
+t1 ref a,b a 5 const 3 where used
+table type possible_keys key key_len ref rows Extra
+t1 ref a,b a 5 const 3 where used
+table type possible_keys key key_len ref rows Extra
+t1 ref a,b a 5 const 1 where used
+table type possible_keys key key_len ref rows Extra
+t1 ALL NULL NULL NULL NULL 12 where used
+table type possible_keys key key_len ref rows Extra
+t1 range a,b a 5 NULL 12 where used
+table type possible_keys key key_len ref rows Extra
+t1 range a,b a 5 NULL 4 where used
+table type possible_keys key key_len ref rows Extra
+t1 ref a,b a 5 const 3 where used
+table type possible_keys key key_len ref rows Extra
+t1 ref a,b a 5 const 3 where used
+table type possible_keys key key_len ref rows Extra
+t1 range a a 5 NULL 1 where used
+table type possible_keys key key_len ref rows Extra
+t1 range a,b a 5 NULL 4 where used
+table type possible_keys key key_len ref rows Extra
+t1 range a a 5 NULL 1 where used
+table type possible_keys key key_len ref rows Extra
+t1 range b b 12 NULL 1 where used
+a b c
+NULL 7 0
+NULL 9 0
+NULL 9 0
+a b c
+NULL 7 0
+a b c
+1 1 0
+2 2 0
+a b c
+1 1 0
+2 2 0
+a b c
+NULL 9 0
+NULL 9 0
+a b c
+NULL 7 0
+7 7 0
+a b c
+NULL 7 0
+NULL 9 0
+NULL 9 0
+a b c
+6 6 0
diff --git a/mysql-test/r/odbc.result b/mysql-test/r/odbc.result
new file mode 100644
index 00000000000..753d80e4539
--- /dev/null
+++ b/mysql-test/r/odbc.result
@@ -0,0 +1,7 @@
+{fn length("hello")} 1997-10-20
+5 1997-10-20
+a b
+2 2
+a b
+Comment
+Impossible WHERE noticed after reading const tables
diff --git a/mysql-test/r/order_by.result b/mysql-test/r/order_by.result
new file mode 100644
index 00000000000..f550e471c4b
--- /dev/null
+++ b/mysql-test/r/order_by.result
@@ -0,0 +1,110 @@
+id idservice ordre description
+2 1 10 Emettre un appel d'offres
+2 3 40000 Créer une fiche de client
+2 4 40010 Modifier des clients
+2 5 40020 Effacer des clients
+2 6 51050 Ajouter un service
+2 7 51060 Liste des t2
+name
+Allan Larsson
+David Axmark
+Michael Widenius
+name
+Axmark David
+Larsson Allan
+Widenius Michael
+i
+1
+2
+3
+i
+1
+3
+2
+i
+3
+2
+1
+i
+3
+2
+1
+i
+2
+1
+3
+id col1 col2
+4 1 1
+3 1 2
+5 1 4
+2 2 1
+1 2 2
+6 2 3
+8 2 4
+7 3 1
+col1
+2
+2
+1
+1
+1
+2
+3
+2
+id
+1
+1
+1
+2
+2
+2
+2
+3
+id
+2
+2
+1
+1
+1
+2
+3
+2
+test
+1
+2
+3
+7
+a b if(b = 1,i,if(b = 2,v,''))
+1 1 50
+2 1 25
+3 2 123 Park Place
+4 2 453 Boardwalk
+a b if(b = 1,i,if(b = 2,v,''))
+1 1 50
+2 1 25
+3 2 123 Park Place
+4 2 453 Boardwalk
+DateOfAction TransactionID
+1999-07-18 486
+1999-07-19 87
+1999-07-19 89
+1999-07-19 92
+1999-07-19 94
+1999-07-27 828
+1999-07-27 832
+1999-07-27 834
+1999-07-27 840
+2000-03-27 490
+2000-03-28 753
+DateOfAction TransactionID
+1999-07-19 87
+1999-07-19 89
+1999-07-19 92
+1999-07-19 94
+1999-07-18 486
+2000-03-27 490
+2000-03-28 753
+1999-07-27 828
+1999-07-27 832
+1999-07-27 834
+1999-07-27 840
diff --git a/mysql-test/r/raid.result b/mysql-test/r/raid.result
new file mode 100644
index 00000000000..ffda2a6966d
--- /dev/null
+++ b/mysql-test/r/raid.result
@@ -0,0 +1,8 @@
+count(*)
+450
+count(*)
+450
+count(*)
+450
+count(*)
+450
diff --git a/mysql-test/r/range.result b/mysql-test/r/range.result
new file mode 100644
index 00000000000..e0e43f44a4b
--- /dev/null
+++ b/mysql-test/r/range.result
@@ -0,0 +1,57 @@
+event_date type event_id
+1999-07-10 100100 24
+1999-07-11 100100 25
+1999-07-13 100600 0
+1999-07-13 100600 4
+1999-07-13 100600 26
+1999-07-14 100600 10
+Comment
+Impossible WHERE
+event_date type event_id
+1999-07-10 100100 24
+1999-07-11 100100 25
+1999-07-13 100600 0
+1999-07-13 100600 4
+1999-07-13 100600 26
+1999-07-14 100600 10
+1999-07-15 100600 16
+YEAR ISSUE
+1999 29
+1999 30
+1999 31
+1999 32
+1999 33
+1999 34
+1999 35
+Table Op Msg_type Msg_text
+test.t1 check status OK
+Table Op Msg_type Msg_text
+test.t1 repair status OK
+id parent_id level
+3 1 1
+4 1 1
+2 1 1
+6 1 1
+7 1 1
+5 1 1
+id parent_id level
+2 1 1
+3 1 1
+4 1 1
+5 1 1
+6 1 1
+7 1 1
+Satellite SensorMode FullImageCornersUpperLeftLongitude FullImageCornersUpperRightLongitude FullImageCornersUpperRightLatitude FullImageCornersLowerRightLatitude
+OV-3 PAN1 91 -92 40 50
+aString
+baaa
+believe
+believe in love
+aString
+believe in myself
+aString
+baaa
+believe
+believe in love
+aString
+believe in myself
diff --git a/mysql-test/r/rename.result b/mysql-test/r/rename.result
new file mode 100644
index 00000000000..57ef20e41b1
--- /dev/null
+++ b/mysql-test/r/rename.result
@@ -0,0 +1,14 @@
+3 table 3
+3 table 3
+1 table 1
+1 table 1
+Tables_in_test (t_)
+t1
+t2
+t3
+1 table 1
+1 table 1
+2 table 2
+2 table 2
+3 table 3
+3 table 3
diff --git a/mysql-test/r/rollback.result b/mysql-test/r/rollback.result
new file mode 100644
index 00000000000..ac3743e1dc7
--- /dev/null
+++ b/mysql-test/r/rollback.result
@@ -0,0 +1,3 @@
+n
+4
+5
diff --git a/mysql-test/r/rpl000001.a.result b/mysql-test/r/rpl000001.a.result
index 982e0523cfb..c52b83d729a 100644
--- a/mysql-test/r/rpl000001.a.result
+++ b/mysql-test/r/rpl000001.a.result
@@ -1,3 +1,3 @@
-n
-1
-2
+n
+1
+2
diff --git a/mysql-test/r/rpl000001.b.result b/mysql-test/r/rpl000001.b.result
index 17cdaf46fa6..5108cfdaf26 100644
--- a/mysql-test/r/rpl000001.b.result
+++ b/mysql-test/r/rpl000001.b.result
@@ -1,2 +1,2 @@
-sum(length(word))
-71
+sum(length(word))
+71
diff --git a/mysql-test/r/rpl000002.result b/mysql-test/r/rpl000002.result
index c76fc46ae97..5b34f36bd05 100644
--- a/mysql-test/r/rpl000002.result
+++ b/mysql-test/r/rpl000002.result
@@ -1,4 +1,4 @@
-n
-2000
-2001
-2002
+n
+2000
+2001
+2002
diff --git a/mysql-test/r/rpl000003.result b/mysql-test/r/rpl000003.result
index c62967af0bb..f85b057eefa 100644
--- a/mysql-test/r/rpl000003.result
+++ b/mysql-test/r/rpl000003.result
@@ -1,4 +1,4 @@
-n
-1
-2
-3
+n
+1
+2
+3
diff --git a/mysql-test/r/rpl000004.a.result b/mysql-test/r/rpl000004.a.result
index 4061fdb4a0d..2c9c8bf0c4f 100644
--- a/mysql-test/r/rpl000004.a.result
+++ b/mysql-test/r/rpl000004.a.result
@@ -1,2 +1,2 @@
-Table Op Msg_type Msg_text
-test.words check status OK
+Table Op Msg_type Msg_text
+test.words check status OK
diff --git a/mysql-test/r/rpl000004.b.result b/mysql-test/r/rpl000004.b.result
index c71e0b46471..7e05933909e 100644
--- a/mysql-test/r/rpl000004.b.result
+++ b/mysql-test/r/rpl000004.b.result
@@ -1,2 +1,2 @@
-count(*)
-10
+count(*)
+10
diff --git a/mysql-test/r/rpl000005.result b/mysql-test/r/rpl000005.result
index 763154b938e..2be354af151 100644
--- a/mysql-test/r/rpl000005.result
+++ b/mysql-test/r/rpl000005.result
@@ -1,4 +1,4 @@
-name age id
-Andy 31 00000001
-Jacob 2 00000002
-Caleb 1 00000003
+name age id
+Andy 31 00000001
+Jacob 2 00000002
+Caleb 1 00000003
diff --git a/mysql-test/r/rpl000006.result b/mysql-test/r/rpl000006.result
index c3e4a2326d0..d2a036b9154 100644
--- a/mysql-test/r/rpl000006.result
+++ b/mysql-test/r/rpl000006.result
@@ -1,2 +1,2 @@
-unix_timestamp(t)
-200006
+unix_timestamp(t)
+200006
diff --git a/mysql-test/r/rpl000007.result b/mysql-test/r/rpl000007.result
index 08f13272f2a..d5b4cdf3bee 100644
--- a/mysql-test/r/rpl000007.result
+++ b/mysql-test/r/rpl000007.result
@@ -1,2 +1,2 @@
-n m
-4 15
+n m
+4 15
diff --git a/mysql-test/r/rpl000008.result b/mysql-test/r/rpl000008.result
index 964ea8d84de..870e8a5510d 100644
--- a/mysql-test/r/rpl000008.result
+++ b/mysql-test/r/rpl000008.result
@@ -1,2 +1,2 @@
-n m k
-4 15 55
+n m k
+4 15 55
diff --git a/mysql-test/r/rpl000009.result b/mysql-test/r/rpl000009.result
index 08f13272f2a..d5b4cdf3bee 100644
--- a/mysql-test/r/rpl000009.result
+++ b/mysql-test/r/rpl000009.result
@@ -1,2 +1,2 @@
-n m
-4 15
+n m
+4 15
diff --git a/mysql-test/r/rpl000010.result b/mysql-test/r/rpl000010.result
index 982e0523cfb..c52b83d729a 100644
--- a/mysql-test/r/rpl000010.result
+++ b/mysql-test/r/rpl000010.result
@@ -1,3 +1,3 @@
-n
-1
-2
+n
+1
+2
diff --git a/mysql-test/r/rpl000011.result b/mysql-test/r/rpl000011.result
index 982e0523cfb..c52b83d729a 100644
--- a/mysql-test/r/rpl000011.result
+++ b/mysql-test/r/rpl000011.result
@@ -1,3 +1,3 @@
-n
-1
-2
+n
+1
+2
diff --git a/mysql-test/r/rpl000012.result b/mysql-test/r/rpl000012.result
index 22fd6be3003..414468f0998 100644
--- a/mysql-test/r/rpl000012.result
+++ b/mysql-test/r/rpl000012.result
@@ -1,7 +1,7 @@
-n
-1
-2
-3
-4
-5
-6
+n
+1
+2
+3
+4
+5
+6
diff --git a/mysql-test/r/rpl000012.status.result b/mysql-test/r/rpl000012.status.result
index fbbae06c3f9..c03e09c99bc 100644
--- a/mysql-test/r/rpl000012.status.result
+++ b/mysql-test/r/rpl000012.status.result
@@ -1,2 +1,2 @@
-Variable_name Value
-Slave_open_temp_tables 0
+Variable_name Value
+Slave_open_temp_tables 0
diff --git a/mysql-test/r/rpl000013.result b/mysql-test/r/rpl000013.result
index 22fd6be3003..414468f0998 100644
--- a/mysql-test/r/rpl000013.result
+++ b/mysql-test/r/rpl000013.result
@@ -1,7 +1,7 @@
-n
-1
-2
-3
-4
-5
-6
+n
+1
+2
+3
+4
+5
+6
diff --git a/mysql-test/r/rpl000013.status.result b/mysql-test/r/rpl000013.status.result
index fbbae06c3f9..c03e09c99bc 100644
--- a/mysql-test/r/rpl000013.status.result
+++ b/mysql-test/r/rpl000013.status.result
@@ -1,2 +1,2 @@
-Variable_name Value
-Slave_open_temp_tables 0
+Variable_name Value
+Slave_open_temp_tables 0
diff --git a/mysql-test/r/rpl000014.result b/mysql-test/r/rpl000014.result
index 25082dcc60f..40421f71fee 100644
--- a/mysql-test/r/rpl000014.result
+++ b/mysql-test/r/rpl000014.result
@@ -1,16 +1,16 @@
-File Position Binlog_do_db Binlog_ignore_db
-master-bin.001 73
-Master_Host Master_User Master_Port Connect_retry Log_File Pos Slave_Running Replicate_do_db Replicate_ignore_db
-127.0.0.1 root 9306 1 73 Yes
-Master_Host Master_User Master_Port Connect_retry Log_File Pos Slave_Running Replicate_do_db Replicate_ignore_db
-127.0.0.1 root 9306 1 73 No
-Master_Host Master_User Master_Port Connect_retry Log_File Pos Slave_Running Replicate_do_db Replicate_ignore_db
-127.0.0.1 root 9306 1 73 Yes
-Master_Host Master_User Master_Port Connect_retry Log_File Pos Slave_Running Replicate_do_db Replicate_ignore_db
-127.0.0.1 root 9306 1 173 Yes
-File Position Binlog_do_db Binlog_ignore_db
-master-bin.001 73
-n
-1
-2
-3
+File Position Binlog_do_db Binlog_ignore_db
+master-bin.001 73
+Master_Host Master_User Master_Port Connect_retry Log_File Pos Slave_Running Replicate_do_db Replicate_ignore_db
+127.0.0.1 root 9306 1 73 Yes
+Master_Host Master_User Master_Port Connect_retry Log_File Pos Slave_Running Replicate_do_db Replicate_ignore_db
+127.0.0.1 root 9306 1 73 No
+Master_Host Master_User Master_Port Connect_retry Log_File Pos Slave_Running Replicate_do_db Replicate_ignore_db
+127.0.0.1 root 9306 1 73 Yes
+Master_Host Master_User Master_Port Connect_retry Log_File Pos Slave_Running Replicate_do_db Replicate_ignore_db
+127.0.0.1 root 9306 1 173 Yes
+File Position Binlog_do_db Binlog_ignore_db
+master-bin.001 73
+n
+1
+2
+3
diff --git a/mysql-test/r/rpl000015.result b/mysql-test/r/rpl000015.result
index 199c2410a09..45abae3976e 100644
--- a/mysql-test/r/rpl000015.result
+++ b/mysql-test/r/rpl000015.result
@@ -1,14 +1,14 @@
-File Position Binlog_do_db Binlog_ignore_db
-master-bin.001 73
-Master_Host Master_User Master_Port Connect_retry Log_File Pos Slave_Running Replicate_do_db Replicate_ignore_db
- 0 0 0 No
-Master_Host Master_User Master_Port Connect_retry Log_File Pos Slave_Running Replicate_do_db Replicate_ignore_db
-127.0.0.1 test 3306 60 4 No
-Master_Host Master_User Master_Port Connect_retry Log_File Pos Slave_Running Replicate_do_db Replicate_ignore_db
-127.0.0.1 root 9306 60 4 No
-Master_Host Master_User Master_Port Connect_retry Log_File Pos Slave_Running Replicate_do_db Replicate_ignore_db
-127.0.0.1 root 9306 60 4 Yes
-n
-10
-45
-90
+File Position Binlog_do_db Binlog_ignore_db
+master-bin.001 73
+Master_Host Master_User Master_Port Connect_retry Log_File Pos Slave_Running Replicate_do_db Replicate_ignore_db
+ 0 0 0 No
+Master_Host Master_User Master_Port Connect_retry Log_File Pos Slave_Running Replicate_do_db Replicate_ignore_db
+127.0.0.1 test 3306 60 4 No
+Master_Host Master_User Master_Port Connect_retry Log_File Pos Slave_Running Replicate_do_db Replicate_ignore_db
+127.0.0.1 root 9306 60 4 No
+Master_Host Master_User Master_Port Connect_retry Log_File Pos Slave_Running Replicate_do_db Replicate_ignore_db
+127.0.0.1 root 9306 60 4 Yes
+n
+10
+45
+90
diff --git a/mysql-test/r/rpl000016.result b/mysql-test/r/rpl000016.result
index 56108ae37cc..5d0ff3877b8 100644
--- a/mysql-test/r/rpl000016.result
+++ b/mysql-test/r/rpl000016.result
@@ -1,14 +1,14 @@
-s
-Could not break slave
-Tried hard
-Log_name
-master-bin.001
-master-bin.002
-master-bin.003
-Log_name
-master-bin.003
-m
-34
-67
-123
-65
+s
+Could not break slave
+Tried hard
+Log_name
+master-bin.001
+master-bin.002
+master-bin.003
+Log_name
+master-bin.003
+m
+34
+67
+123
+65
diff --git a/mysql-test/r/sel000001.result b/mysql-test/r/sel000001.result
index 749778fabac..bee97cc7b53 100644
--- a/mysql-test/r/sel000001.result
+++ b/mysql-test/r/sel000001.result
@@ -1,2 +1,2 @@
-s id
-mouse 3
+s id
+mouse 3
diff --git a/mysql-test/r/sel000002.result b/mysql-test/r/sel000002.result
index c62967af0bb..f85b057eefa 100644
--- a/mysql-test/r/sel000002.result
+++ b/mysql-test/r/sel000002.result
@@ -1,4 +1,4 @@
-n
-1
-2
-3
+n
+1
+2
+3
diff --git a/mysql-test/r/sel000003.result b/mysql-test/r/sel000003.result
index 098e2cce1b0..77312414818 100644
--- a/mysql-test/r/sel000003.result
+++ b/mysql-test/r/sel000003.result
@@ -1,3 +1,3 @@
-n score
-4 10
-2 20
+n score
+4 10
+2 20
diff --git a/mysql-test/r/sel000004.result b/mysql-test/r/sel000004.result
deleted file mode 100644
index 7ef0cdabb96..00000000000
--- a/mysql-test/r/sel000004.result
+++ /dev/null
@@ -1,2 +0,0 @@
-1+1 1-1 1+1*2 8/5 8%5 MOD(8,5) MOD(8,5)|0 -(1+1)*-2 SIGN(-5)
-2 0 3 1.60 3 3 3 4 -1
diff --git a/mysql-test/r/sel000005.result b/mysql-test/r/sel000005.result
deleted file mode 100644
index b213d603c4e..00000000000
--- a/mysql-test/r/sel000005.result
+++ /dev/null
@@ -1,2 +0,0 @@
-FLOOR(5.5) FLOOR(-5.5) CEILING(5.5) CEILING(-5.5) ROUND(5.5) ROUND(-5.5)
-5 -6 6 -5 6 -6
diff --git a/mysql-test/r/sel000006.result b/mysql-test/r/sel000006.result
deleted file mode 100644
index 82967786fce..00000000000
--- a/mysql-test/r/sel000006.result
+++ /dev/null
@@ -1,2 +0,0 @@
-ROUND(5.64,1) ROUND(5.64,2) ROUND(5.64,-1) ROUND(5.64,-2)
-5.6 5.64 10 0
diff --git a/mysql-test/r/sel000007.result b/mysql-test/r/sel000007.result
deleted file mode 100644
index 2a175b2d723..00000000000
--- a/mysql-test/r/sel000007.result
+++ /dev/null
@@ -1,2 +0,0 @@
-TRUNCATE(52.64,1) TRUNCATE(52.64,2) TRUNCATE(52.64,-1) TRUNCATE(52.64,-2)
-52.6 52.64 50 0
diff --git a/mysql-test/r/sel000008.result b/mysql-test/r/sel000008.result
deleted file mode 100644
index 3438a3e6970..00000000000
--- a/mysql-test/r/sel000008.result
+++ /dev/null
@@ -1,2 +0,0 @@
-ABS(-10) LOG(EXP(10)) EXP(LOG(SQRT(10))*2) POW(10,LOG10(10)) RAND(999999) RAND() POWER(2,4)
-10 10.000000 10.000000 10.000000 0.18435012473199 0.76373626176616 16.000000
diff --git a/mysql-test/r/sel000009.result b/mysql-test/r/sel000009.result
deleted file mode 100644
index 410b404774f..00000000000
--- a/mysql-test/r/sel000009.result
+++ /dev/null
@@ -1,2 +0,0 @@
-PI() SIN(PI()/2) COS(PI()/2) TAN(PI()) COT(1) ASIN(1) ACOS(0) ATAN(1)
-3.141593 1.000000 0.000000 -0.000000 0.64209262 1.570796 1.570796 0.785398
diff --git a/mysql-test/r/sel000010.result b/mysql-test/r/sel000010.result
deleted file mode 100644
index 439e30093aa..00000000000
--- a/mysql-test/r/sel000010.result
+++ /dev/null
@@ -1,2 +0,0 @@
-1 | (1+1) 5 & 3 BIT_COUNT(7)
-3 1 3
diff --git a/mysql-test/r/sel000011.result b/mysql-test/r/sel000011.result
deleted file mode 100644
index a0e5f33bc6b..00000000000
--- a/mysql-test/r/sel000011.result
+++ /dev/null
@@ -1,2 +0,0 @@
-1 << 32 1 << 63 1 << 64 4 >> 2 4 >> 63 1<< 63 >> 60
-4294967296 -9223372036854775808 0 1 0 8
diff --git a/mysql-test/r/sel000012.result b/mysql-test/r/sel000012.result
deleted file mode 100644
index 579fe8d87a3..00000000000
--- a/mysql-test/r/sel000012.result
+++ /dev/null
@@ -1,2 +0,0 @@
-10 10.0 10. .1e+2 100.0e-1
-10 10.0 10 10 10
diff --git a/mysql-test/r/sel000013.result b/mysql-test/r/sel000013.result
deleted file mode 100644
index eda7608ef4d..00000000000
--- a/mysql-test/r/sel000013.result
+++ /dev/null
@@ -1,2 +0,0 @@
-6e-05 -6e-05 --6e-05 -6e-05+1.000000
-6e-05 -6e-05 6e-05 0.99994
diff --git a/mysql-test/r/sel000014.result b/mysql-test/r/sel000014.result
deleted file mode 100644
index bd8b967d300..00000000000
--- a/mysql-test/r/sel000014.result
+++ /dev/null
@@ -1,2 +0,0 @@
-0 256 00000000000000065536 2147483647 -2147483648 2147483648 +4294967296
-0 256 65536 2147483647 -2147483648 2147483648 4294967296
diff --git a/mysql-test/r/sel000015.result b/mysql-test/r/sel000015.result
deleted file mode 100644
index e4fca79f398..00000000000
--- a/mysql-test/r/sel000015.result
+++ /dev/null
@@ -1,2 +0,0 @@
-922337203685477580 92233720368547758000
-922337203685477580 92233720368547758080
diff --git a/mysql-test/r/sel000016.result b/mysql-test/r/sel000016.result
deleted file mode 100644
index 58384e104cc..00000000000
--- a/mysql-test/r/sel000016.result
+++ /dev/null
@@ -1,2 +0,0 @@
--922337203685477580 -92233720368547758000
--922337203685477580 -92233720368547758080
diff --git a/mysql-test/r/sel000017.result b/mysql-test/r/sel000017.result
deleted file mode 100644
index d68bb440274..00000000000
--- a/mysql-test/r/sel000017.result
+++ /dev/null
@@ -1,2 +0,0 @@
-9223372036854775807 -009223372036854775808
-9223372036854775807 -9223372036854775808
diff --git a/mysql-test/r/sel000018.result b/mysql-test/r/sel000018.result
deleted file mode 100644
index 1155ffd553e..00000000000
--- a/mysql-test/r/sel000018.result
+++ /dev/null
@@ -1,2 +0,0 @@
-+9999999999999999999 -9999999999999999999
-10000000000000000000 -10000000000000000000
diff --git a/mysql-test/r/sel000019.result b/mysql-test/r/sel000019.result
deleted file mode 100644
index 56e8bfebdcd..00000000000
--- a/mysql-test/r/sel000019.result
+++ /dev/null
@@ -1,2 +0,0 @@
-DEGREES(PI()) RADIANS(360)
-180 6.2831853071796
diff --git a/mysql-test/r/sel000020.result b/mysql-test/r/sel000020.result
deleted file mode 100644
index 3d3b68fca73..00000000000
--- a/mysql-test/r/sel000020.result
+++ /dev/null
@@ -1,2 +0,0 @@
-0=0 1>0 1>=1 1<0 1<=0 1!=0 STRCMP("abc","abcd") STRCMP("b","a") STRCMP("a","a")
-1 1 1 0 0 1 -1 1 0
diff --git a/mysql-test/r/sel000021.result b/mysql-test/r/sel000021.result
deleted file mode 100644
index 03ab284ac5d..00000000000
--- a/mysql-test/r/sel000021.result
+++ /dev/null
@@ -1,2 +0,0 @@
-"a"<"b" "a"<="b" "b">="a" "b">"a" "a"="A" "a"<>"b"
-1 1 1 1 1 1
diff --git a/mysql-test/r/sel000022.result b/mysql-test/r/sel000022.result
deleted file mode 100644
index 4f6dedaa83f..00000000000
--- a/mysql-test/r/sel000022.result
+++ /dev/null
@@ -1,2 +0,0 @@
-"a "="A" "A "="a" "a " <= "A b"
-1 1 1
diff --git a/mysql-test/r/sel000023.result b/mysql-test/r/sel000023.result
deleted file mode 100644
index 835c340b686..00000000000
--- a/mysql-test/r/sel000023.result
+++ /dev/null
@@ -1,2 +0,0 @@
-"abc" LIKE "a%" "abc" NOT LIKE "%d%" "a%" LIKE "a\%" "abc%" LIKE "a%\%" "abcd" LIKE "a%b_%d" "a" LIKE "%%a" "abcde" LIKE "a%_e" "abc" LIKE "abc%"
-1 1 1 1 1 1 1 1
diff --git a/mysql-test/r/sel000024.result b/mysql-test/r/sel000024.result
deleted file mode 100644
index daa9a143b60..00000000000
--- a/mysql-test/r/sel000024.result
+++ /dev/null
@@ -1,2 +0,0 @@
-"a" LIKE "%%b" "a" LIKE "%%ab" "ab" LIKE "a\%" "ab" LIKE "_" "ab" LIKE "ab_" "abc" LIKE "%_d" "abc" LIKE "abc%d"
-0 0 0 0 0 0 0
diff --git a/mysql-test/r/sel000025.result b/mysql-test/r/sel000025.result
deleted file mode 100644
index caf244be1d9..00000000000
--- a/mysql-test/r/sel000025.result
+++ /dev/null
@@ -1,2 +0,0 @@
-'?' LIKE '|%' '?' LIKE '|%' ESCAPE '|' '%' LIKE '|%' '%' LIKE '|%' ESCAPE '|' '%' LIKE '%'
-0 0 0 1 1
diff --git a/mysql-test/r/sel000026.result b/mysql-test/r/sel000026.result
deleted file mode 100644
index acf301a349f..00000000000
--- a/mysql-test/r/sel000026.result
+++ /dev/null
@@ -1,2 +0,0 @@
-'abc' LIKE '%c' 'abcabc' LIKE '%c' "ab" LIKE "" "ab" LIKE "a" "ab" LIKE "ab"
-1 1 0 0 1
diff --git a/mysql-test/r/sel000027.result b/mysql-test/r/sel000027.result
deleted file mode 100644
index df2945c6da8..00000000000
--- a/mysql-test/r/sel000027.result
+++ /dev/null
@@ -1,2 +0,0 @@
-"Det här är svenska" REGEXP "h[[:alpha:]]+r" "aba" REGEXP "^(a|b)*$"
-1 1
diff --git a/mysql-test/r/sel000028.result b/mysql-test/r/sel000028.result
deleted file mode 100644
index cd5b3268b53..00000000000
--- a/mysql-test/r/sel000028.result
+++ /dev/null
@@ -1,2 +0,0 @@
-"aba" REGEXP CONCAT("^","a")
-1
diff --git a/mysql-test/r/sel000029.result b/mysql-test/r/sel000029.result
deleted file mode 100644
index 0ceb7494fd3..00000000000
--- a/mysql-test/r/sel000029.result
+++ /dev/null
@@ -1,2 +0,0 @@
-!0 NOT 0=1 !(0=0) 1 AND 1 1 && 0 0 OR 1 1 || NULL 1=1 OR 1=1 AND 1=0
-1 1 0 1 0 1 1 1
diff --git a/mysql-test/r/sel000030.result b/mysql-test/r/sel000030.result
deleted file mode 100644
index 575549b600f..00000000000
--- a/mysql-test/r/sel000030.result
+++ /dev/null
@@ -1,2 +0,0 @@
-IF(0,"ERROR","this") IF(1,"is","ERROR") IF(NULL,"ERROR","a") IF(1,2,3)|0 IF(1,2.0,3.0)+0
-this is a 2 2.0
diff --git a/mysql-test/r/sel000031.result b/mysql-test/r/sel000031.result
index 26f5563f3df..c1caa04a00a 100644
--- a/mysql-test/r/sel000031.result
+++ b/mysql-test/r/sel000031.result
@@ -1,4 +1,4 @@
-id elt(two.val,'one','two')
-1 one
-2 one
-4 two
+id elt(two.val,'one','two')
+1 one
+2 one
+4 two
diff --git a/mysql-test/r/sel000032.result b/mysql-test/r/sel000032.result
index 26f5563f3df..c1caa04a00a 100644
--- a/mysql-test/r/sel000032.result
+++ b/mysql-test/r/sel000032.result
@@ -1,4 +1,4 @@
-id elt(two.val,'one','two')
-1 one
-2 one
-4 two
+id elt(two.val,'one','two')
+1 one
+2 one
+4 two
diff --git a/mysql-test/r/sel000033.result b/mysql-test/r/sel000033.result
index 201d8bc9e0e..1a1325d4360 100644
--- a/mysql-test/r/sel000033.result
+++ b/mysql-test/r/sel000033.result
@@ -1,4 +1,4 @@
-id
-2
-5
-9
+id
+2
+5
+9
diff --git a/mysql-test/r/sel000100.result b/mysql-test/r/sel000100.result
index 6c204279c28..e7d8cf0e7ac 100644
--- a/mysql-test/r/sel000100.result
+++ b/mysql-test/r/sel000100.result
@@ -1,2 +1,2 @@
-key_link_id link
-NULL NULL
+key_link_id link
+NULL NULL
diff --git a/mysql-test/r/select_safe.result b/mysql-test/r/select_safe.result
new file mode 100644
index 00000000000..1111ba00cd9
--- /dev/null
+++ b/mysql-test/r/select_safe.result
@@ -0,0 +1,10 @@
+a b
+1 test
+a b
+1 test
+2 test2
+1
+1
+1
+1
+1
diff --git a/mysql-test/r/show_check.result b/mysql-test/r/show_check.result
new file mode 100644
index 00000000000..63a9f4a8aad
--- /dev/null
+++ b/mysql-test/r/show_check.result
@@ -0,0 +1,36 @@
+Table Op Msg_type Msg_text
+test.t1 optimize status OK
+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
+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
+Table Op Msg_type Msg_text
+test.t2 check error The handler for the table doesn't support check/repair
+test.t1 check status OK
+Table Op Msg_type Msg_text
+test.t2 check error Table 't2' was not locked with LOCK TABLES
+test.t1 check status OK
+Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Comment
+t1 0 PRIMARY 1 a A 4 NULL NULL
+t1 1 b 1 b A 1 NULL NULL
+t1 1 b 2 c A 2 NULL NULL
+Table Op Msg_type Msg_text
+test.t1 check status Table is already up to date
+Table Op Msg_type Msg_text
+test.t1 check status Table is already up to date
+Table Op Msg_type Msg_text
+test.t1 check status OK
+Table Op Msg_type Msg_text
+test.t1 check status OK
+Table Op Msg_type Msg_text
+test.t1 check status OK
+Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Comment
+t1 0 PRIMARY 1 a A 5 NULL NULL
+t1 1 b 1 b A 1 NULL NULL
+t1 1 b 2 c A 2 NULL NULL
+Table Op Msg_type Msg_text
+test.t1 optimize status OK
+Table Op Msg_type Msg_text
+test.t1 optimize status Table is already up to date
diff --git a/mysql-test/r/shw000001.result b/mysql-test/r/shw000001.result
index f38d2f1ef36..28ad1296d67 100644
--- a/mysql-test/r/shw000001.result
+++ b/mysql-test/r/shw000001.result
@@ -1,5 +1,5 @@
-Table Create Table
+Table Create Table
test CREATE TABLE `test` (
`test_set` set('val1','val2','val3') NOT NULL default '',
`name` char(20) default 'O''Brien'
-) TYPE=MyISAM COMMENT='it''s a table'
+) TYPE=MyISAM COMMENT='it''s a table'
diff --git a/mysql-test/r/slave-running.result b/mysql-test/r/slave-running.result
index 1dc7c7ddd9c..794d0935ef4 100644
--- a/mysql-test/r/slave-running.result
+++ b/mysql-test/r/slave-running.result
@@ -1,2 +1,2 @@
-Variable_name Value
-Slave_running ON
+Variable_name Value
+Slave_running ON
diff --git a/mysql-test/r/slave-stopped.result b/mysql-test/r/slave-stopped.result
index 64323ecc0f3..29ab2ac73e4 100644
--- a/mysql-test/r/slave-stopped.result
+++ b/mysql-test/r/slave-stopped.result
@@ -1,2 +1,2 @@
-Variable_name Value
-Slave_running OFF
+Variable_name Value
+Slave_running OFF
diff --git a/mysql-test/r/tablelock.result b/mysql-test/r/tablelock.result
new file mode 100644
index 00000000000..4fbeac979b1
--- /dev/null
+++ b/mysql-test/r/tablelock.result
@@ -0,0 +1,12 @@
+Table Op Msg_type Msg_text
+test.t1 check status OK
+Table Op Msg_type Msg_text
+test.t1 check status OK
+Table Op Msg_type Msg_text
+test.t1 check status OK
+Table Op Msg_type Msg_text
+test.t1 check status OK
+Table Op Msg_type Msg_text
+test.t1 check status OK
+Table Op Msg_type Msg_text
+test.t1 check status OK
diff --git a/mysql-test/r/temp_table.result b/mysql-test/r/temp_table.result
new file mode 100644
index 00000000000..12e76bba3f7
--- /dev/null
+++ b/mysql-test/r/temp_table.result
@@ -0,0 +1,30 @@
+c d
+1
+2 a
+3 b
+a b
+4 e
+5 f
+6 g
+a b
+4 e
+5 f
+6 g
+a b
+4 e
+5 f
+6 g
+c d
+1
+2 a
+3 b
+c d e
+1 2
+2 a 2
+3 b 2
+CONCAT_WS(pkCrash, strCrash)
+1
+id val elt(two.val,'one','two')
+1 1 one
+2 1 one
+4 2 two
diff --git a/mysql-test/r/truncate.result b/mysql-test/r/truncate.result
new file mode 100644
index 00000000000..716b38c57c7
--- /dev/null
+++ b/mysql-test/r/truncate.result
@@ -0,0 +1,4 @@
+count(*)
+0
+count(*)
+1
diff --git a/mysql-test/r/type_blob.result b/mysql-test/r/type_blob.result
new file mode 100644
index 00000000000..dcc31addc47
--- /dev/null
+++ b/mysql-test/r/type_blob.result
@@ -0,0 +1,289 @@
+last_insert_id()
+3
+nr b str nr b str
+1 a A 1 a A
+2 bbb BBB 1 a A
+3 ccc CCC 1 a A
+1 a A 2 bbb BBB
+2 bbb BBB 2 bbb BBB
+3 ccc CCC 2 bbb BBB
+1 a A 3 ccc CCC
+2 bbb BBB 3 ccc CCC
+3 ccc CCC 3 ccc CCC
+a
+Where
+Field Type Null Key Default Extra Privileges
+t text YES NULL select,insert,update,references
+c varchar(10) YES NULL select,insert,update,references
+b blob YES NULL select,insert,update,references
+d varchar(10) binary YES NULL select,insert,update,references
+Field Type Null Key Default Extra Privileges
+t text YES NULL select,insert,update,references
+c varchar(10) YES NULL select,insert,update,references
+b blob YES NULL select,insert,update,references
+d varchar(10) binary YES NULL select,insert,update,references
+t
+hello
+HELLO
+c
+hello
+HELLO
+b
+hello
+d
+hello
+c
+hello
+HELLO
+d
+hello
+t
+hello
+HELLO
+HELLO MY
+c
+hello
+HELLO
+HELLO MY
+b
+HELLO
+HELLO MY
+d
+HELLO
+HELLO MY
+c
+hello
+HELLO
+HELLO MY
+d
+HELLO
+HELLO MY
+t
+NULL
+NULL
+
+1
+a
+hello
+HELLO
+HELLO MY
+c
+NULL
+NULL
+
+
+a
+hello
+HELLO
+HELLO MY
+b
+NULL
+NULL
+NULL
+
+HELLO
+HELLO MY
+a
+hello
+d
+NULL
+NULL
+
+1
+HELLO
+HELLO MY
+a
+hello
+t
+NULL
+
+hello
+HELLO MY
+a
+1
+b
+NULL
+
+hello
+HELLO
+HELLO MY
+a
+t
+NULL
+
+1
+a
+hello
+HELLO MY
+b
+NULL
+
+HELLO
+HELLO MY
+a
+hello
+t
+NULL
+
+1
+a
+hello
+HELLO MY
+b
+NULL
+
+HELLO
+HELLO MY
+a
+hello
+t
+NULL
+
+hello
+HELLO MY
+a
+1
+b
+NULL
+
+hello
+HELLO
+HELLO MY
+a
+t
+NULL
+
+1
+a
+hello
+HELLO MY
+b
+NULL
+
+HELLO
+HELLO MY
+a
+hello
+c
+NULL
+
+hello
+HELLO MY
+a
+d
+NULL
+
+hello
+HELLO
+HELLO MY
+a
+1
+c
+NULL
+
+a
+hello
+HELLO MY
+d
+NULL
+
+1
+HELLO
+HELLO MY
+a
+hello
+c
+NULL
+
+a
+hello
+HELLO MY
+d
+NULL
+
+1
+HELLO
+HELLO MY
+a
+hello
+t c b d
+NULL NULL NULL NULL
+
+hello hello hello hello
+HELLO HELLO HELLO HELLO
+HELLO MY HELLO MY HELLO MY HELLO MY
+a a a a
+1 NULL 1
+t count(*)
+NULL 2
+ 1
+1 1
+a 1
+hello 2
+HELLO MY 1
+b count(*)
+NULL 3
+ 1
+HELLO 1
+HELLO MY 1
+a 1
+hello 1
+c count(*)
+NULL 2
+ 2
+a 1
+hello 2
+HELLO MY 1
+d count(*)
+NULL 2
+ 1
+1 1
+HELLO 1
+HELLO MY 1
+a 1
+hello 1
+_field_140 min(t3._field_131) min(t3._field_135) min(t3._field_139) min(t3._field_137) min(link_alias_142._field_165) min(link_alias_133._field_72) min(t3._field_145) min(link_alias_148._field_156) replace(min(t3._field_140), "\r","^M") t3_id
+test
+job
+1 test job 1 0000-00-00 00:00:00 1999-02-25 22:43:32 0 High admin 0 tomato test^M
+job^M
+1 1
+stamp
+19990402000000
+stamp
+19990402000000
+date_format(a,"%Y %y") year(a) year(now())
+2000 00 2000 2000
+ix
+19991101000000
+19990102030405
+19990630232922
+19990601000000
+19990930232922
+19990531232922
+19990501000000
+19991101000000
+19990501000000
+date date_time time_stamp
+1998-12-31 1998-12-31 23:59:59 19981231235959
+1999-01-01 1999-01-01 00:00:00 19990101000000
+1999-09-09 1999-09-09 23:59:59 19990909235959
+2000-01-01 2000-01-01 00:00:00 20000101000000
+2000-02-28 2000-02-28 00:00:00 20000228000000
+2000-02-29 2000-02-29 00:00:00 20000229000000
+2000-03-01 2000-03-01 00:00:00 20000301000000
+2000-12-31 2000-12-31 23:59:59 20001231235959
+2001-01-01 2001-01-01 00:00:00 20010101000000
+2004-12-31 2004-12-31 23:59:59 20041231235959
+2005-01-01 2005-01-01 00:00:00 20050101000000
+2030-01-01 2030-01-01 00:00:00 20300101000000
+2050-01-01 2050-01-01 00:00:00 20131126000036
+a reverse(a)
+empty ytpme
+
+a
+hello
+hello
+hello word
+count(*)
+2
diff --git a/mysql-test/r/type_date.result b/mysql-test/r/type_date.result
new file mode 100644
index 00000000000..9aa6d6fb9b7
--- /dev/null
+++ b/mysql-test/r/type_date.result
@@ -0,0 +1,20 @@
+a b c
+test 2000-01-01 2000-01-01 2000-01-01 00:00:00
+a b c
+test 2000-01-01 2000-01-01 2000-01-01 00:00:00
+name cdate note
+name1 1998-01-01 note01
+name2 1998-01-01 note01
+datum
+2000-01-02
+2000-01-03
+2000-01-04
+s
+1998-01-02
+s
+1998-01-04
+s
+19980104
+date_add(date,INTERVAL 1 DAY) date_add(date,INTERVAL 1 SECOND)
+2000-08-11 2000-08-10 00:00:01
+2000-08-12 2000-08-11 00:00:01
diff --git a/mysql-test/r/type_datetime.result b/mysql-test/r/type_datetime.result
new file mode 100644
index 00000000000..3a816e2ff68
--- /dev/null
+++ b/mysql-test/r/type_datetime.result
@@ -0,0 +1,33 @@
+t
+2000-01-01 00:00:00
+2069-12-31 00:00:00
+1970-01-01 00:00:00
+1999-12-31 00:00:00
+1000-01-01 00:00:00
+9999-12-31 00:00:00
+2000-01-01 00:00:00
+2069-12-31 00:00:00
+1970-01-01 00:00:00
+1999-12-31 23:59:59
+1000-01-01 00:00:00
+9999-12-31 23:59:59
+Table Op Msg_type Msg_text
+test.t1 optimize status OK
+t
+2000-01-01 00:00:00
+2069-12-31 00:00:00
+1970-01-01 00:00:00
+1999-12-31 00:00:00
+0000-01-01 00:00:00
+0001-01-01 00:00:00
+9999-12-31 00:00:00
+2000-10-10 00:00:00
+2069-12-31 00:00:00
+1970-01-01 00:00:00
+1999-12-31 23:59:59
+1000-01-01 00:00:00
+9999-12-31 23:59:59
+date_format(a,"%Y-%m-%d")=b right(a,6)=c+0 a=d+0
+1 1 1
+a
+0000-00-00 00:00:00
diff --git a/mysql-test/r/type_enum.result b/mysql-test/r/type_enum.result
new file mode 100644
index 00000000000..de48527edad
--- /dev/null
+++ b/mysql-test/r/type_enum.result
@@ -0,0 +1,1616 @@
+field
+001001
+001010
+001018
+001020
+001021
+001027
+001028
+001030
+001031
+001100
+002003
+002004
+002005
+002007
+002008
+002009
+002012
+002013
+002014
+003002
+003003
+003004
+003005
+003006
+003007
+003008
+003009
+003010
+003011
+003012
+003013
+003014
+003015
+003016
+003017
+003018
+003019
+004003
+004005
+004006
+004008
+004010
+004012
+004014
+004016
+004017
+004020
+004021
+004022
+004023
+004025
+004026
+006004
+006006
+006010
+006011
+006012
+006014
+007001
+007002
+007003
+007005
+007007
+007008
+007009
+007011
+007012
+007013
+007015
+007016
+007017
+007018
+007019
+007020
+007021
+007022
+007023
+007025
+007027
+007029
+007031
+007032
+007034
+007036
+007037
+007038
+007040
+007043
+009001
+009002
+009004
+009005
+009006
+009007
+009008
+009010
+009011
+009012
+009013
+010002
+010003
+010004
+010005
+010006
+010007
+010008
+010009
+010010
+010011
+010012
+010013
+010015
+010016
+010017
+010018
+010019
+010020
+010021
+010022
+010023
+010026
+010027
+010028
+011001
+011002
+011003
+011004
+011006
+011012
+011013
+011014
+011015
+011016
+012017
+012027
+012032
+012034
+012036
+012037
+012038
+012039
+014001
+016016
+016019
+016020
+016021
+016022
+016023
+016024
+016026
+016028
+016029
+016030
+016031
+016032
+016033
+016034
+017002
+018001
+019002
+019004
+020001
+020004
+020006
+020008
+020009
+022001
+022002
+022003
+023001
+023002
+023003
+023004
+023005
+023006
+023007
+023010
+023011
+023017
+023019
+023020
+023025
+023026
+023027
+023028
+023029
+023030
+023032
+023033
+023034
+023035
+025001
+025003
+025004
+025005
+025007
+025008
+025009
+025010
+025011
+025012
+025013
+025014
+025015
+025016
+025018
+025019
+025020
+025021
+025022
+025023
+025024
+025025
+025026
+025027
+025028
+025030
+025031
+025033
+025034
+025035
+025037
+025041
+025042
+025043
+025046
+025048
+025049
+025050
+025051
+025052
+025053
+025054
+025055
+025056
+025057
+025058
+025060
+025061
+025062
+025063
+027001
+027002
+027011
+036001
+037003
+037006
+037007
+037008
+038009
+039001
+039002
+039003
+039004
+039005
+039006
+046001
+046002
+046003
+046005
+046007
+046008
+046009
+046010
+046012
+046013
+046014
+047001
+047002
+048001
+051003
+051004
+052001
+052002
+052005
+053016
+053019
+053023
+053024
+053026
+053028
+053029
+053033
+053045
+053046
+053051
+053054
+053057
+053069
+053097
+053107
+053125
+053127
+054001
+054002
+054003
+054004
+054006
+054007
+054009
+054010
+056001
+056002
+056003
+056004
+056005
+056006
+056009
+056011
+056016
+056017
+056018
+056019
+056020
+056022
+057003
+057004
+058002
+058003
+058004
+058005
+060001
+060004
+060005
+060007
+061004
+061006
+069006
+069007
+069010
+069011
+069012
+069013
+069014
+069015
+069016
+069018
+069020
+069021
+069023
+071002
+071003
+071004
+071005
+071006
+071008
+071011
+071020
+071021
+071022
+072001
+074001
+074002
+074003
+074004
+074005
+074006
+074007
+074008
+074009
+074010
+074011
+074012
+075001
+075007
+076101
+076102
+076103
+077001
+077002
+077003
+077004
+077006
+077008
+077009
+078005
+079002
+079003
+079004
+079005
+079006
+079007
+081001
+082011
+082013
+082014
+082015
+082016
+082017
+082021
+082022
+082023
+082024
+082025
+082026
+082027
+082028
+082029
+082030
+082031
+082032
+082033
+082034
+082035
+082036
+082037
+082038
+082039
+082040
+082041
+082042
+082043
+082044
+084001
+084002
+084003
+084004
+084005
+084007
+084008
+084009
+084011
+084013
+084014
+084016
+084017
+084027
+084032
+084033
+084035
+084036
+084037
+084038
+084039
+084040
+084041
+084042
+084043
+084044
+084045
+084046
+084047
+084048
+084049
+084050
+084051
+085001
+085002
+085003
+085004
+085005
+085006
+085007
+085009
+085011
+085012
+085014
+085015
+085016
+085017
+085018
+085019
+085020
+085022
+085023
+085028
+085029
+085030
+085031
+085033
+085034
+085035
+085036
+085037
+085038
+085040
+085041
+085042
+085043
+085044
+085045
+085046
+085047
+085048
+085063
+085064
+085065
+085068
+085071
+085073
+085082
+085086
+085088
+085089
+085090
+085091
+085092
+085093
+085095
+085096
+085097
+085098
+085099
+085100
+085101
+085102
+085103
+085104
+085105
+085106
+085108
+085109
+085110
+085111
+085112
+085113
+085115
+085120
+085121
+085122
+085123
+085125
+085126
+085127
+085128
+085129
+085130
+085132
+085133
+085134
+085135
+085136
+085137
+086002
+086003
+086005
+088001
+088003
+088005
+088006
+088007
+088008
+088009
+089001
+090001
+090002
+090003
+090004
+090006
+090008
+090009
+090010
+090013
+090016
+090017
+090018
+090022
+090027
+091001
+091002
+091009
+091011
+091012
+091013
+091015
+091016
+091017
+091018
+093003
+099001
+100001
+106001
+113005
+113006
+113018
+113019
+113020
+115001
+115002
+115003
+115004
+115005
+115006
+115007
+115008
+115009
+115010
+115011
+115012
+115013
+115014
+115015
+115016
+115017
+115018
+115020
+115021
+115022
+115023
+115025
+115026
+115027
+115028
+115029
+115030
+115031
+115032
+115033
+115034
+115035
+115036
+115039
+115040
+115041
+115042
+115043
+115044
+115046
+115047
+115048
+115050
+115051
+115052
+115053
+115054
+115055
+115057
+115059
+115060
+115061
+115062
+115064
+115065
+115066
+115067
+115068
+115069
+115070
+115071
+115072
+115073
+115075
+115076
+115081
+115082
+115085
+115086
+115087
+115088
+115095
+115096
+115097
+115098
+115099
+115101
+115102
+115103
+115104
+115105
+115106
+115108
+115109
+115111
+115112
+115113
+115114
+115115
+115116
+115117
+115118
+115119
+115120
+115121
+115122
+116001
+116003
+116004
+116005
+116006
+116007
+116008
+116009
+116010
+116011
+116012
+123001
+124065
+126001
+126002
+126003
+126004
+126005
+126006
+126007
+126008
+126009
+126010
+126011
+126012
+130001
+132001
+132002
+133001
+133008
+133009
+133010
+133011
+133012
+133015
+133016
+133018
+133019
+133021
+133022
+133023
+133024
+133025
+133027
+133028
+133029
+133030
+133031
+134001
+135001
+135002
+135004
+135010
+137010
+137011
+137012
+137014
+137015
+137016
+137019
+139001
+140001
+141001
+141002
+141003
+141006
+141007
+141009
+141011
+141012
+141014
+141015
+141016
+141017
+141018
+141019
+141020
+141021
+141022
+141023
+141024
+141025
+141026
+141027
+141028
+145001
+145002
+145003
+145004
+145005
+145006
+145008
+145009
+145011
+145012
+145013
+150009
+150013
+150014
+150015
+150016
+150017
+150020
+152001
+152002
+152003
+152004
+152005
+152006
+152007
+154001
+154002
+155001
+155002
+155003
+155004
+155006
+159001
+159003
+160001
+160002
+161001
+162002
+162003
+162007
+162012
+163001
+163011
+163015
+163016
+165001
+165002
+165003
+165004
+165005
+165006
+165007
+165008
+165009
+165010
+165011
+165012
+165013
+165014
+165015
+165016
+165017
+165018
+165019
+165020
+165021
+165022
+165023
+165024
+165025
+165026
+165028
+165029
+165030
+165031
+165033
+165034
+165035
+165036
+168003
+168004
+168005
+168014
+169001
+169002
+169003
+169007
+169008
+169009
+169010
+171006
+171007
+171008
+171009
+172001
+176001
+176002
+176003
+177001
+179007
+179012
+179013
+179042
+179044
+179045
+180001
+180013
+180014
+180015
+180017
+180018
+180020
+180021
+180027
+180030
+180033
+180035
+180036
+180037
+180038
+180041
+180042
+180045
+180047
+180048
+180049
+180050
+180054
+180060
+180066
+180067
+180068
+180070
+182001
+184001
+184002
+184005
+184006
+184008
+184009
+184010
+184011
+185001
+185003
+187001
+191002
+192002
+194003
+197001
+197002
+197003
+197004
+197005
+197006
+198001
+198003
+198004
+198005
+198006
+198007
+198008
+198009
+198010
+198011
+198012
+198015
+198016
+198017
+201001
+201002
+202001
+203001
+203002
+203003
+203017
+203018
+203019
+204001
+204002
+205001
+208001
+208002
+208003
+208004
+208005
+209001
+209002
+209003
+210001
+210004
+210009
+210010
+212001
+212002
+212003
+212004
+212005
+212006
+212007
+212008
+212009
+212010
+212011
+212012
+212013
+218001
+218004
+218009
+218011
+218015
+218020
+218021
+218022
+218023
+218024
+218025
+218026
+218027
+218028
+218029
+218030
+218031
+221001
+221002
+221003
+221004
+221005
+221006
+221007
+221008
+221009
+221010
+221011
+221012
+221013
+223003
+224001
+224002
+224003
+224007
+224008
+225001
+225002
+225003
+225004
+225005
+225006
+225007
+225008
+225009
+225010
+225011
+225012
+225013
+226001
+226002
+226003
+226005
+226006
+226007
+227011
+227015
+227041
+227045
+227052
+227056
+227063
+227064
+227066
+227067
+227069
+227071
+227073
+227085
+227116
+227119
+227131
+227133
+227147
+229005
+233003
+233004
+235001
+235002
+235003
+235004
+235005
+236001
+236002
+236003
+238002
+238003
+238004
+238005
+238007
+238008
+334005
+334006
+337001
+337002
+337003
+337004
+343001
+344001
+344002
+344003
+344004
+344005
+345001
+348001
+348004
+348005
+349001
+349002
+350001
+353002
+353003
+355001
+355002
+355005
+355006
+356001
+358001
+359001
+359002
+360001
+360002
+360003
+360004
+360005
+366001
+366002
+366003
+366004
+369001
+373001
+373002
+373003
+373005
+373007
+373008
+373009
+373010
+373011
+373012
+373013
+373014
+373015
+373017
+373018
+373021
+374002
+374004
+374006
+374007
+374008
+374009
+374010
+374011
+374012
+374015
+374016
+382001
+382002
+384001
+386001
+386002
+386003
+386004
+386005
+386006
+386007
+386008
+386009
+386010
+386011
+386012
+386013
+386014
+389001
+389002
+389003
+389004
+392001
+393001
+393002
+393003
+393004
+395001
+397001
+397002
+399001
+399002
+399003
+400001
+400002
+403002
+504001
+504002
+504004
+504005
+504006
+504007
+504008
+504009
+504010
+504011
+504012
+504014
+504017
+504021
+504022
+504023
+504024
+504025
+506001
+506002
+511001
+511002
+511003
+511004
+511005
+511006
+511007
+511008
+511009
+511010
+511011
+511012
+511013
+511014
+511017
+511018
+511020
+511021
+511022
+511024
+511028
+511029
+513001
+513002
+513003
+513004
+515001
+515002
+515003
+515007
+515008
+515011
+515012
+515013
+515014
+515015
+518001
+518002
+521001
+521002
+521003
+521004
+521005
+521006
+521009
+521010
+521011
+521012
+521013
+521015
+521016
+523001
+523002
+523003
+523004
+523005
+523006
+523007
+524001
+700001
+701001
+701002
+701003
+702001
+702002
+702004
+702005
+704001
+704004
+705001
+706001
+706002
+707001
+707002
+707003
+708001
+710001
+710002
+711001
+711002
+712001
+714001
+714002
+715001
+719001
+719002
+991002
+991003
+991004
+991005
+991006
+991007
+995001
+996001
+996002
+996003
+998001
+998002
+998003
+998004
+998005
+998006
+998007
+999001
+999002
+011017
+011018
+034001
+034002
+071010
+519001
+126013
+184012
+404001
+405002
+405001
+405003
+405006
+240011
+240010
+240009
+240008
+240007
+240005
+240004
+240003
+240002
+240001
+240012
+240013
+240014
+240015
+240016
+240017
+357001
+235006
+235007
+056023
+046015
+019005
+126014
+241003
+241002
+241001
+240020
+240019
+242001
+242002
+242004
+242005
+242006
+089002
+406001
+406002
+406003
+406004
+243001
+243005
+243006
+243007
+243008
+408001
+366005
+016035
+077010
+996004
+025064
+011019
+115123
+504026
+039007
+039009
+039008
+039010
+039011
+039012
+180072
+240021
+240023
+405008
+525002
+410002
+410004
+410005
+410006
+410007
+410008
+410009
+410010
+410011
+410012
+410013
+410014
+410016
+344006
+240031
+240030
+240029
+240028
+240027
+240026
+240025
+240024
+240034
+240033
+240032
+411001
+411002
+203020
+069025
+244001
+244002
+244009
+244008
+244007
+244006
+244004
+244003
+244014
+244013
+244012
+244011
+244016
+244017
+240040
+240037
+405009
+405010
+240043
+504028
+504040
+800001
+410019
+410020
+410021
+244018
+244019
+244020
+413001
+344007
+082045
+010031
+010032
+010033
+010034
+010035
+504044
+515016
+801002
+801003
+801004
+801005
+802001
+801001
+414001
+141029
+803001
+803002
+803004
+803005
+803006
+803007
+803008
+803009
+803013
+803014
+803015
+803016
+803017
+410022
+410023
+803019
+415002
+415001
+244021
+011020
+011023
+011022
+011021
+025065
+165037
+165038
+165039
+416001
+416002
+416003
+417001
+418001
+504045
+803022
+240022
+420001
+804010
+804005
+804002
+804018
+804013
+511019
+511016
+511015
+511032
+511031
+511030
+511027
+511026
+511025
+511033
+511023
+133034
+133033
+169011
+344008
+244022
+244026
+244025
+244030
+244023
+244024
+244027
+244028
+244029
+244031
+082046
+082047
+082048
+126015
+126016
+416005
+421001
+421002
+016037
+016036
+115124
+115126
+240049
+240048
+240047
+240046
+240045
+240044
+244032
+244033
+422002
+422004
+422005
+184013
+805001
+805002
+805003
+805004
+805005
+056024
+423001
+344010
+235009
+212014
+056025
+056026
+244034
+244035
+244036
+244037
+244038
+244039
+203015
+245002
+245001
+056029
+056030
+056032
+424001
+056034
+056033
+805006
+805007
+805008
+805009
+805010
+422008
+422007
+422006
+422010
+422009
+422011
+209004
+150022
+100002
+056035
+023036
+185005
+246001
+247001
+247002
+425001
+416006
+165042
+165041
+165040
+165043
+010040
+010039
+010038
+010036
+248001
+248002
+248003
+248004
+248005
+249001
+249003
+249004
+249005
+250007
+250001
+250002
+250003
+250004
+250005
+250006
+250008
+250009
+250010
+250011
+250012
+250013
+251001
+251002
+806001
+806002
+235010
+243009
+249007
+249008
+249009
+011024
+011025
+429001
+429002
+429003
diff --git a/mysql-test/r/type_float.result b/mysql-test/r/type_float.result
new file mode 100644
index 00000000000..93a38e9967f
--- /dev/null
+++ b/mysql-test/r/type_float.result
@@ -0,0 +1,66 @@
+10 10.0 10. .1e+2 100.0e-1
+10 10.0 10 10 10
+6e-05 -6e-05 --6e-05 -6e-05+1.000000
+6e-05 -6e-05 6e-05 0.99994
+Field Type Null Key Default Extra Privileges
+f1 float YES NULL select,insert,update,references
+f2 double YES NULL select,insert,update,references
+f1 f2
+10 10
+100000 100000
+1.23457e+09 1234567890
+1e+10 10000000000
+1e+15 1e+15
+1e+20 1e+20
+3.40282e+38 1e+50
+3.40282e+38 1e+150
+-10 -10
+1e-05 1e-05
+1e-10 1e-10
+1e-15 1e-15
+1e-20 1e-20
+0 1e-50
+0 1e-150
+datum
+0.5
+1
+1.5
+2
+2.5
+datum
+0.5
+1
+datum
+2
+2.5
+datum
+1.5
+a
+-0.010
+-0.002
+-0.000
+0.000
+1.000
+min(a)
+-0.010
+Field Type Null Key Default Extra Privileges
+f float YES NULL select,insert,update,references
+f2 float YES NULL select,insert,update,references
+f3 float(6,2) YES NULL select,insert,update,references
+d double YES NULL select,insert,update,references
+d2 double YES NULL select,insert,update,references
+d3 double(10,3) YES NULL select,insert,update,references
+de decimal(10,0) YES NULL select,insert,update,references
+de2 decimal(6,0) YES NULL select,insert,update,references
+de3 decimal(5,2) YES NULL select,insert,update,references
+n decimal(10,0) YES NULL select,insert,update,references
+n2 decimal(8,0) YES NULL select,insert,update,references
+n3 decimal(8,6) YES NULL select,insert,update,references
+a
+-0.010
+-0.002
+-0.000
+0.000
+1.000
+min(a)
+-0.010
diff --git a/mysql-test/r/type_ranges.result b/mysql-test/r/type_ranges.result
new file mode 100644
index 00000000000..abb8ef8cb09
--- /dev/null
+++ b/mysql-test/r/type_ranges.result
@@ -0,0 +1,159 @@
+Field Type Null Key Default Extra Privileges
+auto int(5) unsigned PRI NULL auto_increment select,insert,update,references
+string varchar(10) YES hello select,insert,update,references
+tiny tinyint(4) MUL 0 select,insert,update,references
+short smallint(6) MUL 1 select,insert,update,references
+medium mediumint(8) MUL 0 select,insert,update,references
+long_int int(11) 0 select,insert,update,references
+longlong bigint(13) MUL 0 select,insert,update,references
+real_float float(13,1) MUL 0.0 select,insert,update,references
+real_double double(16,4) YES NULL select,insert,update,references
+utiny tinyint(3) unsigned MUL 0 select,insert,update,references
+ushort smallint(5) unsigned zerofill MUL 00000 select,insert,update,references
+umedium mediumint(8) unsigned MUL 0 select,insert,update,references
+ulong int(11) unsigned MUL 0 select,insert,update,references
+ulonglong bigint(13) unsigned MUL 0 select,insert,update,references
+time_stamp timestamp(14) YES NULL select,insert,update,references
+date_field date YES NULL select,insert,update,references
+time_field time YES NULL select,insert,update,references
+date_time datetime YES NULL select,insert,update,references
+blob_col blob YES NULL select,insert,update,references
+tinyblob_col tinyblob YES NULL select,insert,update,references
+mediumblob_col mediumblob select,insert,update,references
+longblob_col longblob select,insert,update,references
+options enum('one','two','tree') MUL one select,insert,update,references
+flags set('one','two','tree') select,insert,update,references
+Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Comment
+t1 0 PRIMARY 1 auto A 0 NULL NULL
+t1 1 utiny 1 utiny A NULL NULL NULL
+t1 1 tiny 1 tiny A NULL NULL NULL
+t1 1 short 1 short A NULL NULL NULL
+t1 1 any_name 1 medium A NULL NULL NULL
+t1 1 longlong 1 longlong A NULL NULL NULL
+t1 1 real_float 1 real_float A NULL NULL NULL
+t1 1 ushort 1 ushort A NULL NULL NULL
+t1 1 umedium 1 umedium A NULL NULL NULL
+t1 1 ulong 1 ulong A NULL NULL NULL
+t1 1 ulonglong 1 ulonglong A NULL NULL NULL
+t1 1 ulonglong 2 ulong A NULL NULL NULL
+t1 1 options 1 options A NULL NULL NULL
+t1 1 options 2 flags A NULL NULL NULL
+auto string tiny short medium long_int longlong real_float real_double utiny ushort umedium ulong ulonglong mod(floor(time_stamp/1000000),1000000)-mod(curdate(),1000000) date_field time_field date_time blob_col tinyblob_col mediumblob_col longblob_col
+10 1 1 1 1 1 1 1.0 1.0000 1 00001 1 1 1 0 0000-00-00 00:00:00 0000-00-00 00:00:00 1 1 1 1
+11 2 2 2 2 2 2 2.0 2.0000 2 00002 2 2 2 0 NULL NULL NULL NULL NULL 2 2
+12 0.33 3 3 3 3 3 3.0 3.0000 3 00003 3 3 3 0 1997-03-03 10:10:10 1997-03-03 10:10:10 3
+13 -1 -1 -1 -1 -1 -1 -1.0 -1.0000 0 00000 0 0 18446744073709551615 0 1997-08-07 08:07:06 1997-04-03 09:08:07 -1 -1 -1 -1
+14 -429496729 -128 -32768 -8388608 -2147483648 -4294967295 -4294967296.0 -4294967295.0000 0 00000 0 0 18446744069414584321 0 0000-00-00 00:00:00 0000-00-00 00:00:00 -4294967295 -4294967295 -4294967295 -4294967295
+15 4294967295 127 32767 8388607 2147483647 4294967295 4294967296.0 4294967295.0000 255 65535 16777215 4294967295 4294967295 0 0000-00-00 00:00:00 0000-00-00 00:00:00 4294967295 4294967295 4294967295 4294967295
+16 hello 1 1 0 0 0 0.0 NULL 0 00000 0 0 0 0 NULL NULL NULL NULL NULL
+auto new_field new_blob_col date_field
+10 new 1 0000-00-00
+11 new NULL NULL
+12 new 1997-03-03
+13 new -1 1997-08-07
+14 new -4294967295 0000-00-00
+15 new 4294967295 0000-00-00
+16 new NULL NULL
+auto string mediumblob_col new_field
+1 2 2 ne
+2 0.33 ne
+3 -1 -1 ne
+4 -429496729 -4294967295 ne
+5 4294967295 4294967295 ne
+6 hello ne
+flags
+
+one,two,tree
+one
+one,two
+flags
+one,two,tree
+one,two,tree
+one,two
+one,two
+flags
+options flags
+one one
+options flags
+one one
+Field Type Null Key Default Extra Privileges
+auto int(5) unsigned MUL NULL auto_increment select,insert,update,references
+string varchar(10) YES new defaul select,insert,update,references
+tiny tinyint(4) MUL 0 select,insert,update,references
+short smallint(6) MUL 0 select,insert,update,references
+medium mediumint(8) MUL 0 select,insert,update,references
+long_int int(11) 0 select,insert,update,references
+longlong bigint(13) MUL 0 select,insert,update,references
+real_float float(13,1) MUL 0.0 select,insert,update,references
+real_double double(16,4) YES NULL select,insert,update,references
+utiny tinyint(3) unsigned 0 select,insert,update,references
+ushort smallint(5) unsigned zerofill 00000 select,insert,update,references
+umedium mediumint(8) unsigned MUL 0 select,insert,update,references
+ulong int(11) unsigned MUL 0 select,insert,update,references
+ulonglong bigint(13) unsigned MUL 0 select,insert,update,references
+time_stamp timestamp(14) YES NULL select,insert,update,references
+date_field varchar(10) YES NULL select,insert,update,references
+time_field time YES NULL select,insert,update,references
+date_time datetime YES NULL select,insert,update,references
+new_blob_col varchar(20) YES NULL select,insert,update,references
+tinyblob_col tinyblob YES NULL select,insert,update,references
+mediumblob_col mediumblob select,insert,update,references
+options enum('one','two','tree') MUL one select,insert,update,references
+flags set('one','two','tree') select,insert,update,references
+new_field varchar(10) new select,insert,update,references
+Field Type Null Key Default Extra Privileges
+auto int(5) unsigned 0 select,insert,update,references
+string varchar(10) YES new defaul select,insert,update,references
+tiny tinyint(4) 0 select,insert,update,references
+short smallint(6) 0 select,insert,update,references
+medium mediumint(8) 0 select,insert,update,references
+long_int int(11) 0 select,insert,update,references
+longlong bigint(13) 0 select,insert,update,references
+real_float float(13,1) 0.0 select,insert,update,references
+real_double double(16,4) YES NULL select,insert,update,references
+utiny tinyint(3) unsigned 0 select,insert,update,references
+ushort smallint(5) unsigned zerofill 00000 select,insert,update,references
+umedium mediumint(8) unsigned 0 select,insert,update,references
+ulong int(11) unsigned 0 select,insert,update,references
+ulonglong bigint(13) unsigned 0 select,insert,update,references
+time_stamp timestamp(14) YES NULL select,insert,update,references
+date_field varchar(10) YES NULL select,insert,update,references
+time_field time YES NULL select,insert,update,references
+date_time datetime YES NULL select,insert,update,references
+new_blob_col varchar(20) YES NULL select,insert,update,references
+tinyblob_col tinyblob YES NULL select,insert,update,references
+mediumblob_col mediumblob select,insert,update,references
+options enum('one','two','tree') one select,insert,update,references
+flags set('one','two','tree') select,insert,update,references
+new_field varchar(10) new select,insert,update,references
+auto auto
+16 16
+auto auto
+16 16
+Field Type Null Key Default Extra Privileges
+auto bigint(17) PRI 0 select,insert,update,references
+t1 bigint(1) 0 select,insert,update,references
+t2 char(1) select,insert,update,references
+t3 mediumtext select,insert,update,references
+t4 mediumblob select,insert,update,references
+auto t1 t2 t3 t4
+11 1 a aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
+12 1 a aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
+13 1 a aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
+14 1 a aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
+15 1 a aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
+16 1 a aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
+17 1 a aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
+Field Type Null Key Default Extra Privileges
+c1 int(11) YES NULL select,insert,update,references
+c2 int(11) YES NULL select,insert,update,references
+const bigint(1) 0 select,insert,update,references
+id_A id_B
+1 1
+2 NULL
+id_A id_B
+1 1
+2 NULL
+id_A id_B
+1 1
+2 NULL
diff --git a/mysql-test/r/type_time.result b/mysql-test/r/type_time.result
new file mode 100644
index 00000000000..1a137a89b1e
--- /dev/null
+++ b/mysql-test/r/type_time.result
@@ -0,0 +1,68 @@
+t
+10:22:33
+12:34:56
+00:00:10
+00:12:34
+12:34:56
+123:45:59
+00:00:01
+01:23:00
+01:23:45
+00:00:10
+-241:22:33
+490:22:33
+20:33:34
+00:00:30
+00:12:30
+00:12:30
+12:30:00
+12:30:35
+36:30:31
+t
+10:22:33
+12:34:56
+00:00:10
+00:12:34
+12:34:56
+123:45:59
+00:00:01
+01:23:00
+01:23:45
+00:00:10
+-241:22:33
+490:22:33
+20:33:34
+00:00:30
+00:12:30
+00:12:30
+12:30:00
+12:30:35
+36:30:31
+00:00:10
+00:00:00
+838:59:59
+838:59:59
+262:22:00
+00:00:12
+t time_to_sec(t) sec_to_time(time_to_sec(t))
+09:00:00 32400 09:00:00
+13:00:00 46800 13:00:00
+19:38:34 70714 19:38:34
+13:00:00 46800 13:00:00
+09:00:00 32400 09:00:00
+09:00:00 32400 09:00:00
+13:00:00 46800 13:00:00
+13:00:00 46800 13:00:00
+13:00:00 46800 13:00:00
+09:00:00 32400 09:00:00
+sec_to_time(time_to_sec(t))
+09:00:00
+13:00:00
+19:38:34
+13:00:00
+09:00:00
+09:00:00
+13:00:00
+13:00:00
+13:00:00
+09:00:00
diff --git a/mysql-test/r/type_timestamp.result b/mysql-test/r/type_timestamp.result
new file mode 100644
index 00000000000..8dcf99ebcd1
--- /dev/null
+++ b/mysql-test/r/type_timestamp.result
@@ -0,0 +1,2 @@
+t
+19700101022034
diff --git a/mysql-test/r/type_uint.result b/mysql-test/r/type_uint.result
new file mode 100644
index 00000000000..54fa717e0f8
--- /dev/null
+++ b/mysql-test/r/type_uint.result
@@ -0,0 +1,3 @@
+this
+1
+0
diff --git a/mysql-test/r/type_year.result b/mysql-test/r/type_year.result
new file mode 100644
index 00000000000..7dc15a4dd1b
--- /dev/null
+++ b/mysql-test/r/type_year.result
@@ -0,0 +1,21 @@
+y y2
+0000 00
+1999 99
+2000 00
+2001 01
+1970 70
+2069 69
+y y2
+0000 00
+1970 70
+1999 99
+2000 00
+2001 01
+2069 69
+y y2
+1970 70
+1999 99
+0000 00
+2000 00
+2001 01
+2069 69
diff --git a/mysql-test/r/update.result b/mysql-test/r/update.result
new file mode 100644
index 00000000000..9aa47a089a6
--- /dev/null
+++ b/mysql-test/r/update.result
@@ -0,0 +1,2 @@
+place_id shows
+1 1
diff --git a/mysql-test/r/varbinary.result b/mysql-test/r/varbinary.result
new file mode 100644
index 00000000000..62aeae21970
--- /dev/null
+++ b/mysql-test/r/varbinary.result
@@ -0,0 +1,6 @@
+0x41 0x41+0 0x41 | 0x7fffffffffffffff | 0 0xffffffffffffffff | 0
+A 65 9223372036854775807 -1
+0x31+1 concat(0x31)+1 -0xf
+50 2 -15
+table type possible_keys key key_len ref rows Extra
+t1 const UNIQ UNIQ 8 const 1
diff --git a/mysql-test/r/variables.result b/mysql-test/r/variables.result
new file mode 100644
index 00000000000..ee04e437bb7
--- /dev/null
+++ b/mysql-test/r/variables.result
@@ -0,0 +1,12 @@
+@test @`select` @TEST @not_used
+1 2 3 NULL
+@test_int @test_double @test_string @test_string2 @select
+10 0.00 abcdeghi abcdefghij NULL
+@test_int @test_double @test_string @test_string2
+hello hello hello hello
+@test_int @test_double @test_string @test_string2
+hellohello hellohello hellohello hellohello
+@test_int @test_double @test_string @test_string2
+NULL NULL NULL NULL
+@t1:=(@t2:=1)+@t3:=4 @t1 @t2 @t3
+5 5 1 4
diff --git a/mysql-test/t/alt000001.test b/mysql-test/t/alt000001.test
deleted file mode 100644
index 88defc5b035..00000000000
--- a/mysql-test/t/alt000001.test
+++ /dev/null
@@ -1,6 +0,0 @@
-use test;
-drop table if exists x;
-create table x (n int);
-insert into x values(9),(3),(12),(10);
-alter table x order by n;
-@r/alt000001.result select * from x;
diff --git a/mysql-test/t/alter_table.test b/mysql-test/t/alter_table.test
new file mode 100644
index 00000000000..e2a6a1af43d
--- /dev/null
+++ b/mysql-test/t/alter_table.test
@@ -0,0 +1,48 @@
+#
+# Test of alter table
+#
+
+drop table if exists t1;
+create table t1 (
+col1 int not null auto_increment primary key,
+col2 varchar(30) not null,
+col3 varchar (20) not null,
+col4 varchar(4) not null,
+col5 enum('PENDING', 'ACTIVE', 'DISABLED') not null,
+col6 int not null, to_be_deleted int);
+alter table t1
+add column col4_5 varchar(20) not null after col4,
+add column col7 varchar(30) not null after col6,
+add column col8 datetime not null, drop column to_be_deleted;
+drop table t1;
+
+create table t1 (bandID MEDIUMINT UNSIGNED NOT NULL PRIMARY KEY, payoutID SMALLINT UNSIGNED NOT NULL);
+insert into t1 (bandID,payoutID) VALUES (1,6),(2,6),(3,4),(4,9),(5,10),(6,1),(7,12),(8,12);
+alter table t1 add column new_col int, order by payoutid,bandid;
+select * from t1;
+alter table t1 order by bandid,payoutid;
+select * from t1;
+drop table t1;
+
+# Check that pack_keys and dynamic length rows are not forced.
+
+CREATE TABLE t1 (
+GROUP_ID int(10) unsigned DEFAULT '0' NOT NULL,
+LANG_ID smallint(5) unsigned DEFAULT '0' NOT NULL,
+NAME varchar(80) DEFAULT '' NOT NULL,
+PRIMARY KEY (GROUP_ID,LANG_ID),
+KEY NAME (NAME));
+#show table status like "t1";
+ALTER TABLE t1 CHANGE NAME NAME CHAR(80) not null;
+SHOW COLUMNS FROM t1;
+DROP TABLE t1;
+
+#
+# Test of ALTER TABLE ... ORDER BY
+#
+
+create table t1 (n int);
+insert into t1 values(9),(3),(12),(10);
+alter table t1 order by n;
+select * from t1;
+drop table t1;
diff --git a/mysql-test/t/analyse.test b/mysql-test/t/analyse.test
new file mode 100644
index 00000000000..1b5022f6e4c
--- /dev/null
+++ b/mysql-test/t/analyse.test
@@ -0,0 +1,10 @@
+#
+# Test of procedure analyse
+#
+
+create table t1 (i int, j int);
+insert into t1 values (1,2), (3,4), (5,6), (7,8);
+select * from t1 procedure analyse();
+create table t2 select * from t1 procedure analyse();
+select * from t2;
+drop table t1,t2;
diff --git a/mysql-test/t/auto_increment.test b/mysql-test/t/auto_increment.test
new file mode 100644
index 00000000000..1741b51b2d6
--- /dev/null
+++ b/mysql-test/t/auto_increment.test
@@ -0,0 +1,66 @@
+#
+# Test of auto_increment; The test for BDB tables is in bdb.test
+#
+
+create table t1 (a int not null auto_increment,b int, primary key (a)) type=myisam auto_increment=3;
+insert into t1 values (1,1),(NULL,3),(NULL,4);
+delete from t1 where a=4;
+insert into t1 values (NULL,5),(NULL,6);
+select * from t1;
+delete from t1 where a=6;
+#show table status like "t1";
+replace t1 values (3,1);
+ALTER TABLE t1 add c int;
+replace t1 values (3,3,3);
+insert into t1 values (NULL,7,7);
+update t1 set a=8,b=b+1,c=c+1 where a=7;
+insert into t1 values (NULL,9,9);
+select * from t1;
+drop table t1;
+
+create table t1 (a int not null auto_increment,b int, primary key (a)) type=isam;
+insert into t1 values (1,1),(NULL,2),(3,3),(NULL,4);
+delete from t1 where a=4 or a=2;
+insert into t1 values (NULL,4),(NULL,5),(6,6);
+select * from t1;
+delete from t1 where a=6;
+#show table status like "t1";
+replace t1 values (3,1);
+replace t1 values (3,3);
+ALTER TABLE t1 add c int;
+insert into t1 values (NULL,6,6);
+select * from t1;
+drop table t1;
+
+create table t1 (
+ skey tinyint unsigned NOT NULL auto_increment PRIMARY KEY,
+ sval char(20)
+);
+insert into t1 values (NULL, "hello");
+insert into t1 values (NULL, "hey");
+select * from t1;
+select _rowid,t1._rowid,skey,sval from t1;
+drop table t1;
+
+#
+# Test auto_increment on sub key
+#
+create table t1 (a char(10) not null, b int not null auto_increment, primary key(a,b));
+insert into t1 values ("a",1),("b",2),("a",2),("c",1);
+insert into t1 values ("a",NULL),("b",NULL),("c",NULL),("e",NULL);
+insert into t1 (a) values ("a"),("b"),("c"),("d");
+insert into t1 (a) values ('k'),('d');
+insert into t1 (a) values ("a");
+insert into t1 values ("d",last_insert_id());
+select * from t1;
+drop table t1;
+
+create table t1 (ordid int(8) not null auto_increment, ord varchar(50) not null, primary key (ordid), index(ord,ordid));
+insert into t1 (ordid,ord) values (NULL,'sdj'),(NULL,'sdj');
+select * from t1;
+drop table t1;
+
+create table t1 (ordid int(8) not null auto_increment, ord varchar(50) not null, primary key (ord,ordid));
+insert into t1 values (NULL,'sdj'),(NULL,'sdj'),(NULL,"abc"),(NULL,'abc'),(NULL,'zzz'),(NULL,'sdj'),(NULL,'abc');
+select * from t1;
+drop table t1;
diff --git a/mysql-test/t/bdb.test b/mysql-test/t/bdb.test
new file mode 100644
index 00000000000..c03dd16dce5
--- /dev/null
+++ b/mysql-test/t/bdb.test
@@ -0,0 +1,328 @@
+-- source include/have_bdb.inc
+
+#
+# Small basic test with ignore
+#
+
+drop table if exists t1;
+create table t1 (id int unsigned not null auto_increment, code tinyint unsigned not null, name char(20) not null, primary key (id), key (code), unique (name)) type=bdb;
+
+insert into t1 (code, name) values (1, 'Tim'), (1, 'Monty'), (2, 'David'), (2, 'Erik'), (3, 'Sasha'), (3, 'Jeremy'), (4, 'Matt');
+select id, code, name from t1 order by id;
+
+update ignore t1 set id = 8, name = 'Sinisa' where id < 3;
+select id, code, name from t1 order by id;
+update ignore t1 set id = id + 10, name = 'Ralph' where id < 4;
+select id, code, name from t1 order by id;
+
+drop table t1;
+
+#
+# A bit bigger test
+#
+
+CREATE TABLE t1 (
+ id int(11) NOT NULL auto_increment,
+ parent_id int(11) DEFAULT '0' NOT NULL,
+ level tinyint(4) DEFAULT '0' NOT NULL,
+ PRIMARY KEY (id),
+ KEY parent_id (parent_id),
+ KEY level (level)
+) type=bdb;
+INSERT INTO t1 VALUES (1,0,0),(3,1,1),(4,1,1),(8,2,2),(9,2,2),(17,3,2),(22,4,2),(24,4,2),(28,5,2),(29,5,2),(30,5,2),(31,6,2),(32,6,2),(33,6,2),(203,7,2),(202,7,2),(20,3,2),(157,0,0),(193,5,2),(40,7,2),(2,1,1),(15,2,2),(6,1,1),(34,6,2),(35,6,2),(16,3,2),(7,1,1),(36,7,2),(18,3,2),(26,5,2),(27,5,2),(183,4,2),(38,7,2),(25,5,2),(37,7,2),(21,4,2),(19,3,2),(5,1,1),(179,5,2);
+update t1 set parent_id=parent_id+100;
+select * from t1 where parent_id=102;
+update t1 set id=id+1000;
+!$1062 update t1 set id=1024 where id=1009;
+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;
+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;
+select level,id from t1 where level=1;
+select level,id,parent_id from t1 where level=1;
+drop table t1;
+
+#
+# Test replace
+#
+
+CREATE TABLE t1 (
+ gesuchnr int(11) DEFAULT '0' NOT NULL,
+ benutzer_id int(11) DEFAULT '0' NOT NULL,
+ PRIMARY KEY (gesuchnr,benutzer_id)
+) type=BDB;
+
+replace into t1 (gesuchnr,benutzer_id) values (2,1);
+replace into t1 (gesuchnr,benutzer_id) values (1,1);
+replace into t1 (gesuchnr,benutzer_id) values (1,1);
+select * from t1;
+drop table t1;
+
+#
+# test delete using hidden_primary_key
+#
+
+create table t1 (a int) type=bdb;
+insert into t1 values (1), (2);
+delete from t1 where a = 1;
+select * from t1;
+drop table t1;
+
+#
+# Test auto_increment on sub key
+#
+
+create table t1 (a char(10) not null, b int not null auto_increment, primary key(a,b)) type=BDB;
+insert into t1 values ("a",1),("b",2),("a",2),("c",1);
+insert into t1 values ("a",NULL),("b",NULL),("c",NULL),("e",NULL);
+insert into t1 (a) values ("a"),("b"),("c"),("d");
+insert into t1 (a) values ('k'),('d');
+insert into t1 (a) values ("a");
+insert into t1 values ("d",last_insert_id());
+select * from t1;
+drop table t1;
+
+#
+# Test rollback
+#
+
+create table t1 (n int not null primary key) type=bdb;
+set autocommit=0;
+insert into t1 values (4);
+rollback;
+select n, "after rollback" from t1;
+insert into t1 values (4);
+commit;
+select n, "after commit" from t1;
+commit;
+insert into t1 values (5);
+!$1062 insert into t1 values (4);
+commit;
+select n, "after commit" from t1;
+set autocommit=1;
+insert into t1 values (6);
+!$1062 insert into t1 values (4);
+select n from t1;
+# nop
+rollback;
+drop table t1;
+
+#
+# Testing transactions
+#
+
+create table t1 ( id int NOT NULL PRIMARY KEY, nom varchar(64)) type=BDB;
+begin;
+insert into t1 values(1,'hamdouni');
+select id as afterbegin_id,nom as afterbegin_nom from t1;
+rollback;
+select id as afterrollback_id,nom as afterrollback_nom from t1;
+set autocommit=0;
+insert into t1 values(2,'mysql');
+select id as afterautocommit0_id,nom as afterautocommit0_nom from t1;
+rollback;
+select id as afterrollback_id,nom as afterrollback_nom from t1;
+set autocommit=1;
+drop table t1;
+
+#
+# Simple not autocommit test
+#
+
+CREATE TABLE t1 (id char(8) not null primary key, val int not null) type=bdb;
+insert into t1 values ('pippo', 12);
+!$1062 insert into t1 values ('pippo', 12); # Gives error
+delete from t1;
+delete from t1 where id = 'pippo';
+select * from t1;
+
+insert into t1 values ('pippo', 12);
+set autocommit=0;
+delete from t1;
+rollback;
+select * from t1;
+delete from t1;
+commit;
+select * from t1;
+drop table t1;
+set autocommit=1;
+
+#
+# The following simple tests failed at some point
+#
+
+CREATE TABLE t1 (ID INTEGER NOT NULL PRIMARY KEY, NAME VARCHAR(64)) TYPE=BDB;
+INSERT INTO t1 VALUES (1, 'Jochen');
+select * from t1;
+drop table t1;
+
+CREATE TABLE t1 ( _userid VARCHAR(60) NOT NULL PRIMARY KEY) TYPE=BDB;
+set autocommit=0;
+INSERT INTO t1 SET _userid='marc@anyware.co.uk';
+COMMIT;
+SELECT * FROM t1;
+SELECT _userid FROM t1 WHERE _userid='marc@anyware.co.uk';
+drop table t1;
+set autocommit=1;
+
+#
+# Test when reading on part of unique key
+#
+CREATE TABLE t1 (
+ user_id int(10) DEFAULT '0' NOT NULL,
+ name varchar(100),
+ phone varchar(100),
+ ref_email varchar(100) DEFAULT '' NOT NULL,
+ detail varchar(200),
+ PRIMARY KEY (user_id,ref_email)
+)type=bdb;
+
+INSERT INTO t1 VALUES (10292,'sanjeev','29153373','sansh777@hotmail.com','xxx'),(10292,'shirish','2333604','shirish@yahoo.com','ddsds'),(10292,'sonali','323232','sonali@bolly.com','filmstar');
+select * from t1 where user_id=10292;
+INSERT INTO t1 VALUES (10291,'sanjeev','29153373','sansh777@hotmail.com','xxx'),(10293,'shirish','2333604','shirish@yahoo.com','ddsds');
+select * from t1 where user_id=10292;
+select * from t1 where user_id>=10292;
+select * from t1 where user_id>10292;
+select * from t1 where user_id<10292;
+drop table t1;
+
+#
+# Test that keys are created in right order
+#
+
+CREATE TABLE t1 (a int not null, b int not null,c int not null,
+key(a),primary key(a,b), unique(c),key(a),unique(b));
+show index from t1;
+drop table t1;
+
+#
+# Test of ALTER TABLE and BDB tables
+#
+
+create table t1 (col1 int not null, col2 char(4) not null, primary key(col1));
+alter table t1 type=BDB;
+insert into t1 values ('1','1'),('5','2'),('2','3'),('3','4'),('4','4');
+select * from t1;
+update t1 set col2='7' where col1='4';
+select * from t1;
+alter table t1 add co3 int not null;
+select * from t1;
+update t1 set col2='9' where col1='2';
+select * from t1;
+drop table t1;
+
+#
+# INSERT INTO BDB tables
+#
+
+create table t1 (a int not null , b int, primary key (a)) type = BDB;
+create table t2 (a int not null , b int, primary key (a)) type = myisam;
+insert into t1 VALUES (1,3) , (2,3), (3,3);
+select * from t1;
+insert into t2 select * from t1;
+select * from t2;
+delete from t1 where b = 3;
+select * from t1;
+insert into t1 select * from t2;
+select * from t1;
+select * from t2;
+drop table t1,t2;
+
+#
+# Search on unique key
+#
+
+CREATE TABLE t1 (
+ id int(11) NOT NULL auto_increment,
+ ggid varchar(32) binary DEFAULT '' NOT NULL,
+ email varchar(64) DEFAULT '' NOT NULL,
+ passwd varchar(32) binary DEFAULT '' NOT NULL,
+ PRIMARY KEY (id),
+ UNIQUE ggid (ggid)
+) TYPE=BDB;
+
+insert into t1 (ggid,passwd) values ('test1','xxx');
+insert into t1 (ggid,passwd) values ('test2','yyy');
+
+select * from t1 where ggid='test1';
+select * from t1 where passwd='xxx';
+select * from t1 where id=2;
+drop table t1;
+
+#
+# ORDER BY on not primary key
+#
+
+CREATE TABLE t1 (
+ user_name varchar(12),
+ password text,
+ subscribed char(1),
+ user_id int(11) DEFAULT '0' NOT NULL,
+ quota bigint(20),
+ weight double,
+ access_date date,
+ access_time time,
+ approved datetime,
+ dummy_primary_key int(11) NOT NULL auto_increment,
+ PRIMARY KEY (dummy_primary_key)
+) TYPE=BDB;
+INSERT INTO t1 VALUES ('user_0','somepassword','N',0,0,0,'2000-09-07','23:06:59','2000-09-07 23:06:59',1);
+INSERT INTO t1 VALUES ('user_1','somepassword','Y',1,1,1,'2000-09-07','23:06:59','2000-09-07 23:06:59',2);
+INSERT INTO t1 VALUES ('user_2','somepassword','N',2,2,1.4142135623731,'2000-09-07','23:06:59','2000-09-07 23:06:59',3);
+INSERT INTO t1 VALUES ('user_3','somepassword','Y',3,3,1.7320508075689,'2000-09-07','23:06:59','2000-09-07 23:06:59',4);
+INSERT INTO t1 VALUES ('user_4','somepassword','N',4,4,2,'2000-09-07','23:06:59','2000-09-07 23:06:59',5);
+select user_name, password , subscribed, user_id, quota, weight, access_date, access_time, approved, dummy_primary_key from t1 order by user_name;
+drop table t1;
+
+#
+# Testing of tables without primary keys
+#
+
+CREATE TABLE t1 (
+ id int(11) NOT NULL auto_increment,
+ parent_id int(11) DEFAULT '0' NOT NULL,
+ level tinyint(4) DEFAULT '0' NOT NULL,
+ KEY (id),
+ KEY parent_id (parent_id),
+ KEY level (level)
+) type=bdb;
+INSERT INTO t1 VALUES (1,0,0),(3,1,1),(4,1,1),(8,2,2),(9,2,2),(17,3,2),(22,4,2),(24,4,2),(28,5,2),(29,5,2),(30,5,2),(31,6,2),(32,6,2),(33,6,2),(203,7,2),(202,7,2),(20,3,2),(157,0,0),(193,5,2),(40,7,2),(2,1,1),(15,2,2),(6,1,1),(34,6,2),(35,6,2),(16,3,2),(7,1,1),(36,7,2),(18,3,2),(26,5,2),(27,5,2),(183,4,2),(38,7,2),(25,5,2),(37,7,2),(21,4,2),(19,3,2),(5,1,1);
+INSERT INTO t1 values (179,5,2);
+update t1 set parent_id=parent_id+100;
+select * from t1 where parent_id=102;
+update t1 set id=id+1000;
+update t1 set id=1024 where id=1009;
+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;
+explain select level from t1 where level=1;
+select level,id from t1 where level=1;
+select level,id,parent_id from t1 where level=1;
+select level,id from t1 where level=1 order by id;
+delete from t1 where level=1;
+select * from t1;
+drop table t1;
+
+#
+# Test of index only reads
+#
+CREATE TABLE t1 (
+ sca_code char(6) NOT NULL,
+ cat_code char(6) NOT NULL,
+ sca_desc varchar(50),
+ lan_code char(2) NOT NULL,
+ sca_pic varchar(100),
+ sca_sdesc varchar(50),
+ sca_sch_desc varchar(16),
+ PRIMARY KEY (sca_code, cat_code, lan_code)
+) type = bdb ;
+
+INSERT INTO t1 ( sca_code, cat_code, sca_desc, lan_code, sca_pic, sca_sdesc, sca_sch_desc) VALUES ( 'PD', 'J', 'PENDANT', 'EN', NULL, NULL, 'PENDANT'),( 'RI', 'J', 'RING', 'EN', NULL, NULL, 'RING');
+select count(*) from t1 where sca_code = 'PD';
+drop table t1;
diff --git a/mysql-test/t/bigint.test b/mysql-test/t/bigint.test
new file mode 100644
index 00000000000..91997c811b5
--- /dev/null
+++ b/mysql-test/t/bigint.test
@@ -0,0 +1,14 @@
+#
+# Test of reading of bigint values
+#
+select 0,256,00000000000000065536,2147483647,-2147483648,2147483648,+4294967296;
+select 922337203685477580,92233720368547758000;
+select -922337203685477580,-92233720368547758000;
+select 9223372036854775807,-009223372036854775808;
+select +9999999999999999999,-9999999999999999999;
+
+drop table if exists t1;
+create table t1 (a bigint unsigned);
+insert into t1 values (18446744073709551615), (0xFFFFFFFFFFFFFFFF);
+select * from t1;
+drop table t1;
diff --git a/mysql-test/t/binary.test b/mysql-test/t/binary.test
new file mode 100644
index 00000000000..7853b013ae6
--- /dev/null
+++ b/mysql-test/t/binary.test
@@ -0,0 +1,33 @@
+#
+# test sort,min and max on binary fields
+#
+
+create table t1 (name char(20) not null, primary key (name));
+create table t2 (name char(20) binary not null, primary key (name));
+insert into t1 values ("å");
+insert into t1 values ("ä");
+insert into t1 values ("ö");
+insert into t2 select * from t1;
+
+select * from t1 order by name;
+select concat("*",name,"*") from t1 order by 1;
+select min(name),min(concat("*",name,"*")),max(name),max(concat("*",name,"*")) from t1;
+select * from t2 order by name;
+select concat("*",name,"*") from t2 order by 1;
+select min(name),min(concat("*",name,"*")),max(name),max(concat("*",name,"*")) from t2;
+select name from t1 where name between 'Ä' and 'Ö';
+select name from t2 where name between 'ä' and 'ö';
+select name from t2 where name between 'Ä' and 'Ö';
+
+drop table t1,t2;
+
+#
+# Test of binary and normal strings
+#
+
+create table t1 (a char(10) not null, b char(10) binary not null,index (a));
+insert into t1 values ("hello ","hello "),("hello2 ","hello2 ");
+select * from t1 where a="hello ";
+select * from t1 where b="hello ";
+select * from t1 where b="hello";
+drop table t1;
diff --git a/mysql-test/t/case.test b/mysql-test/t/case.test
new file mode 100644
index 00000000000..9e594675c19
--- /dev/null
+++ b/mysql-test/t/case.test
@@ -0,0 +1,21 @@
+#
+# Testing of CASE
+#
+
+select CASE "b" when "a" then 1 when "b" then 2 END;
+select CASE "c" when "a" then 1 when "b" then 2 END;
+select CASE "c" when "a" then 1 when "b" then 2 ELSE 3 END;
+select CASE BINARY "b" when "a" then 1 when "B" then 2 WHEN "b" then "ok" END;
+select CASE "b" when "a" then 1 when binary "B" then 2 WHEN "b" then "ok" END;
+select CASE concat("a","b") when concat("ab","") then "a" when "b" then "b" end;
+select CASE when 1=0 then "true" else "false" END;
+select CASE 1 when 1 then "one" WHEN 2 then "two" ELSE "more" END;
+select CASE 2.0 when 1 then "one" WHEN 2.0 then "two" ELSE "more" END;
+select (CASE "two" when "one" then "1" WHEN "two" then "2" END) | 0;
+select (CASE "two" when "one" then 1.00 WHEN "two" then 2.00 END) +0.0;
+select case 1/0 when "a" then "true" else "false" END;
+select case 1/0 when "a" then "true" END;
+select (case 1/0 when "a" then "true" END) | 0;
+select (case 1/0 when "a" then "true" END) + 0.0;
+select case when 1>0 then "TRUE" else "FALSE" END;
+select case when 1<0 then "TRUE" else "FALSE" END;
diff --git a/mysql-test/t/comments.test b/mysql-test/t/comments.test
new file mode 100644
index 00000000000..a85419c0295
--- /dev/null
+++ b/mysql-test/t/comments.test
@@ -0,0 +1,17 @@
+#
+# Testing of comments
+#
+
+select 1+2/*hello*/+3;
+select 1 /* long
+multi line comment */;
+!$1065 /* empty query */;
+select 1 /*!32301 +1 */;
+select 1 /*!52301 +1 */;
+select 1--1;
+# Note that the following returns 4 while it should return 2
+# This is because the mysqld server doesn't parse -- comments
+select 1 --2
++1;
+select 1 # The rest of the row will be ignored
+;
diff --git a/mysql-test/t/compare.test b/mysql-test/t/compare.test
new file mode 100644
index 00000000000..b5596784f35
--- /dev/null
+++ b/mysql-test/t/compare.test
@@ -0,0 +1,11 @@
+#
+# Bug when using comparions of strings and integers.
+#
+
+CREATE TABLE t1 (id CHAR(12) not null, PRIMARY KEY (id));
+insert into t1 values ('000000000001'),('000000000002');
+explain select * from t1 where id=000000000001;
+select * from t1 where id=000000000001;
+delete from t1 where id=000000000002;
+select * from t1;
+drop table t1;
diff --git a/mysql-test/t/count_distinct.test b/mysql-test/t/count_distinct.test
new file mode 100644
index 00000000000..1afb548c2ad
--- /dev/null
+++ b/mysql-test/t/count_distinct.test
@@ -0,0 +1,34 @@
+#
+# Problem with count(distinct)
+#
+
+drop table if exists t1,t2,t3;
+create table t1 (libname varchar(21) not null, city text, primary key (libname));
+create table t2 (isbn varchar(21) not null, author text, title text, primary key (isbn));
+create table t3 (isbn varchar(21) not null, libname varchar(21) not null, quantity int ,primary key (isbn,libname));
+insert into t2 values ('001','Daffy','A duck''s life');
+insert into t2 values ('002','Bugs','A rabbit\'s life');
+insert into t2 values ('003','Cowboy','Life on the range');
+insert into t2 values ('000','Anonymous','Wanna buy this book?');
+insert into t2 values ('004','Best Seller','One Heckuva book');
+insert into t2 values ('005','EveryoneBuys','This very book');
+insert into t2 values ('006','San Fran','It is a san fran lifestyle');
+insert into t2 values ('007','BerkAuthor','Cool.Berkley.the.book');
+insert into t3 values('000','New York Public Libra','1');
+insert into t3 values('001','New York Public Libra','2');
+insert into t3 values('002','New York Public Libra','3');
+insert into t3 values('003','New York Public Libra','4');
+insert into t3 values('004','New York Public Libra','5');
+insert into t3 values('005','New York Public Libra','6');
+insert into t3 values('006','San Fransisco Public','5');
+insert into t3 values('007','Berkeley Public1','3');
+insert into t3 values('007','Berkeley Public2','3');
+insert into t3 values('001','NYC Lib','8');
+insert into t1 values ('New York Public Libra','New York');
+insert into t1 values ('San Fransisco Public','San Fran');
+insert into t1 values ('Berkeley Public1','Berkeley');
+insert into t1 values ('Berkeley Public2','Berkeley');
+insert into t1 values ('NYC Lib','New York');
+select t2.isbn,city,t1.libname,count(t1.libname) as a from t3 left join t1 on t3.libname=t1.libname left join t2 on t3.isbn=t2.isbn group by city,t1.libname;
+select t2.isbn,city,t1.libname,count(distinct t1.libname) as a from t3 left join t1 on t3.libname=t1.libname left join t2 on t3.isbn=t2.isbn group by city having count(distinct t1.libname) > 1;
+drop table t1, t2, t3;
diff --git a/mysql-test/t/create.test b/mysql-test/t/create.test
new file mode 100644
index 00000000000..ad8f733ca4f
--- /dev/null
+++ b/mysql-test/t/create.test
@@ -0,0 +1,58 @@
+#
+# Check some special create statements.
+#
+
+create table t1 (b char(0));
+insert into t1 values (""),(null);
+select * from t1;
+drop table if exists t1;
+
+create table t1 (b char(0) not null);
+create table if not exists t1 (b char(0) not null);
+insert into t1 values (""),(null);
+select * from t1;
+drop table if exists t1;
+
+#
+# Test of some CREATE TABLE'S that should fail
+#
+
+!$1146 create table t2 type=heap select * from t1;
+!$1146 create table t2 select auto+1 from t1;
+drop table if exists t1,t2;
+!$1167 create table t1 (b char(0) not null, index(b));
+!$1164 create table t1 (a int not null auto_increment,primary key (a)) type=heap;
+!$1163 create table t1 (a int not null,b text) type=heap;
+!$1171 create table t1 (a int ,primary key(a)) type=heap;
+!$1121 create table t1 (a int,b text, index(a)) type=isam;
+!$1073 create table t1 (a int,b text, index(b)) type=isam;
+drop table if exists t1;
+
+!$1075 create table t1 (ordid int(8) not null auto_increment, ord varchar(50) not null, primary key (ord,ordid)) type=isam;
+!$1164 create table t1 (ordid int(8) not null auto_increment, ord varchar(50) not null, primary key (ord,ordid)) type=heap;
+!$1171 create table t1 (ordid int(8), primary key (ordid));
+!$1121 create table t1 (ordid int(8), unique (ordid)) type=isam;
+
+!$1044 create table not_existing_database.test (a int);
+!$1103 create table `a/a` (a int);
+!$1103 create table `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa` (aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa int);
+!$1059 create table a (`aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa` int);
+
+#
+# test of dummy table names
+#
+
+create table 1ea10 (1a20 int,1e int);
+insert into 1ea10 values(1,1);
+select 1ea10.1a20,1e+ 1e+10 from 1ea10;
+drop table 1ea10;
+create table t1 (t1.index int);
+drop table t1;
+drop database if exists test_$1;
+create database test_$1;
+create table test_$1.$test1 (a$1 int, $b int, c$ int);
+insert into test_$1.$test1 values (1,2,3);
+select a$1, $b, c$ from test_$1.$test1;
+create table test_$1.test2$ (a int);
+drop table test_$1.test2$;
+drop database test_$1;
diff --git a/mysql-test/t/delayed.test b/mysql-test/t/delayed.test
new file mode 100644
index 00000000000..15a85a09b8d
--- /dev/null
+++ b/mysql-test/t/delayed.test
@@ -0,0 +1,17 @@
+#
+# test of DELAYED insert and timestamps
+# (Can't be tested with purify :( )
+#
+
+create table t1 (a char(10), tmsp timestamp);
+insert into t1 set a = 1;
+insert delayed into t1 set a = 2;
+insert into t1 set a = 3, tmsp=NULL;
+insert delayed into t1 set a = 4;
+insert delayed into t1 set a = 5, tmsp = 19711006010203;
+insert delayed into t1 (a, tmsp) values (6, 19711006010203);
+insert delayed into t1 (a, tmsp) values (7, NULL);
+insert into t1 set a = 8,tmsp=19711006010203;
+select * from t1 where tmsp=0;
+select * from t1 where tmsp=19711006010203;
+drop table t1;
diff --git a/mysql-test/t/delete.test b/mysql-test/t/delete.test
index 85802354b2c..953e22cdd55 100644
--- a/mysql-test/t/delete.test
+++ b/mysql-test/t/delete.test
@@ -1,8 +1,37 @@
+#
+# Check for problems with delete
+#
+
drop table if exists t1;
+CREATE TABLE t1 (a tinyint(3), b tinyint(5));
+INSERT INTO t1 VALUES (1,1);
+INSERT LOW_PRIORITY INTO t1 VALUES (1,2);
+INSERT INTO t1 VALUES (1,3);
+DELETE from t1 where a=1 limit 1;
+DELETE LOW_PRIORITY from t1 where a=1;
+
+INSERT INTO t1 VALUES (1,1);
+DELETE from t1;
+LOCK TABLE t1 write;
+INSERT INTO t1 VALUES (1,2);
+DELETE from t1;
+UNLOCK TABLES;
+INSERT INTO t1 VALUES (1,2);
+SET AUTOCOMMIT=0;
+DELETE from t1;
+SET AUTOCOMMIT=1;
+drop table t1;
-# test delete using hidden_primary_key
-create table t1 (a int) type=bdb;
-insert into t1 values (1), (2);
-delete from t1 where a = 1;
+#
+# Test of delete when the delete will cause a node to disappear and reappear
+# (This assumes a block size of 1024)
+#
+create table t1 (a bigint not null, primary key (a,a,a,a,a,a,a,a,a,a));
+insert into t1 values (2),(4),(6),(8),(10),(12),(14),(16),(18),(20),(22),(24),(26),(23);
+delete from t1 where a=26;
+drop table t1;
+create table t1 (a bigint not null, primary key (a,a,a,a,a,a,a,a,a,a));
+insert into t1 values (2),(4),(6),(8),(10),(12),(14),(16),(18),(20),(22),(24),(26),(23),(27);
+delete from t1 where a=27;
drop table t1;
diff --git a/mysql-test/t/distinct.test b/mysql-test/t/distinct.test
new file mode 100644
index 00000000000..9ddc7ac4a9b
--- /dev/null
+++ b/mysql-test/t/distinct.test
@@ -0,0 +1,184 @@
+#
+# Bug with distinct and INSERT INTO
+# Bug with group by and not used fields
+#
+
+drop table if exists t1,t2,t3;
+
+CREATE TABLE t1 (id int,facility char(20));
+CREATE TABLE t2 (facility char(20));
+INSERT INTO t1 VALUES (NULL,NULL);
+INSERT INTO t1 VALUES (-1,'');
+INSERT INTO t1 VALUES (0,'');
+INSERT INTO t1 VALUES (1,'/L');
+INSERT INTO t1 VALUES (2,'A01');
+INSERT INTO t1 VALUES (3,'ANC');
+INSERT INTO t1 VALUES (4,'F01');
+INSERT INTO t1 VALUES (5,'FBX');
+INSERT INTO t1 VALUES (6,'MT');
+INSERT INTO t1 VALUES (7,'P');
+INSERT INTO t1 VALUES (8,'RV');
+INSERT INTO t1 VALUES (9,'SRV');
+INSERT INTO t1 VALUES (10,'VMT');
+INSERT INTO t2 SELECT DISTINCT FACILITY FROM t1;
+
+select id from t1 group by id;
+select * from t1 order by id;
+select id-5,facility from t1 order by "id-5";
+select id,concat(facility) from t1 group by id ;
+select id+0 as a,max(id),concat(facility) as b from t1 group by a order by b desc,a;
+select id >= 0 and id <= 5 as grp,count(*) from t1 group by grp;
+
+SELECT DISTINCT FACILITY FROM t1;
+SELECT FACILITY FROM t2;
+SELECT count(*) from t1,t2 where t1.facility=t2.facility;
+select count(facility) from t1;
+select count(*) from t1;
+select count(*) from t1 where facility IS NULL;
+select count(*) from t1 where facility = NULL;
+select count(*) from t1 where facility IS NOT NULL;
+select count(*) from t1 where id IS NULL;
+select count(*) from t1 where id IS NOT NULL;
+
+drop table t1,t2;
+
+#
+# Problem with distinct without results
+#
+CREATE TABLE t1 (UserId int(11) DEFAULT '0' NOT NULL);
+INSERT INTO t1 VALUES (20);
+INSERT INTO t1 VALUES (27);
+
+SELECT UserId FROM t1 WHERE Userid=22;
+SELECT UserId FROM t1 WHERE UserId=22 group by Userid;
+SELECT DISTINCT UserId FROM t1 WHERE UserId=22 group by Userid;
+SELECT DISTINCT UserId FROM t1 WHERE UserId=22;
+drop table t1;
+
+#
+# Test of distinct
+#
+
+CREATE TABLE t1 (a int(10) unsigned not null primary key,b int(10) unsigned);
+INSERT INTO t1 VALUES (1,1),(2,1);
+CREATE TABLE t2 (a int(10) unsigned not null, key (A));
+INSERT INTO t2 VALUES (1),(2);
+CREATE TABLE t3 (a int(10) unsigned, key(A), b text);
+INSERT INTO t3 VALUES (1,'1'),(2,'2');
+SELECT DISTINCT t3.b FROM t3,t2,t1 WHERE t3.a=t1.b AND t1.a=t2.a;
+INSERT INTO t2 values (1),(2),(3);
+INSERT INTO t3 VALUES (1,'1'),(2,'2'),(1,'1'),(2,'2');
+explain SELECT distinct t3.a FROM t3,t2,t1 WHERE t3.a=t1.b AND t1.a=t2.a;
+SELECT distinct t3.a FROM t3,t2,t1 WHERE t3.a=t1.b AND t1.a=t2.a;
+
+# Create a lot of data into t3;
+create temporary table t4 select * from t3;
+insert into t3 select * from t4;
+insert into t4 select * from t3;
+insert into t3 select * from t4;
+insert into t4 select * from t3;
+insert into t3 select * from t4;
+insert into t4 select * from t3;
+insert into t3 select * from t4;
+
+explain select distinct t1.a from t1,t3 where t1.a=t3.a;
+#flush status;
+select distinct t1.a from t1,t3 where t1.a=t3.a;
+#show status like 'Handler%';
+#flush status;
+select distinct 1 from t1,t3 where t1.a=t3.a;
+#show status like 'Handler%';
+drop table t1,t2,t3,t4;
+
+CREATE TABLE t1 (name varchar(255));
+INSERT INTO t1 VALUES ('aa'),('ab'),('ac'),('ad'),('ae');
+SELECT DISTINCT * FROM t1 LIMIT 2;
+SELECT DISTINCT name FROM t1 LIMIT 2;
+SELECT DISTINCT 1 FROM t1 LIMIT 2;
+drop table t1;
+
+CREATE TABLE t1 (
+ ID int(11) NOT NULL auto_increment,
+ NAME varchar(75) DEFAULT '' NOT NULL,
+ LINK_ID int(11) DEFAULT '0' NOT NULL,
+ PRIMARY KEY (ID),
+ KEY NAME (NAME),
+ KEY LINK_ID (LINK_ID)
+);
+
+INSERT INTO t1 (ID, NAME, LINK_ID) VALUES (1,'Mike',0),(2,'Jack',0),(3,'Bill',0);
+
+CREATE TABLE t2 (
+ ID int(11) NOT NULL auto_increment,
+ NAME varchar(150) DEFAULT '' NOT NULL,
+ PRIMARY KEY (ID),
+ KEY NAME (NAME)
+);
+
+SELECT DISTINCT
+ t2.id AS key_link_id,
+ t2.name AS link
+FROM t1
+LEFT JOIN t2 ON t1.link_id=t2.id
+GROUP BY t1.id
+ORDER BY link;
+drop table t1,t2;
+
+#
+# Problem with table dependencies
+#
+
+create table t1 (
+ id int not null,
+ name tinytext not null,
+ unique (id)
+);
+create table t2 (
+ id int not null,
+ idx int not null,
+ unique (id, idx)
+);
+create table t3 (
+ id int not null,
+ idx int not null,
+ unique (id, idx)
+);
+insert into t1 values (1,'yes'), (2,'no');
+insert into t2 values (1,1);
+insert into t3 values (1,1);
+EXPLAIN
+SELECT DISTINCT
+ t1.id
+from
+ t1
+ straight_join
+ t2
+ straight_join
+ t3
+ straight_join
+ t1 as j_lj_t2 left join t2 as t2_lj
+ on j_lj_t2.id=t2_lj.id
+ straight_join
+ t1 as j_lj_t3 left join t3 as t3_lj
+ on j_lj_t3.id=t3_lj.id
+WHERE
+ ((t1.id=j_lj_t2.id AND t2_lj.id IS NULL) OR (t1.id=t2.id AND t2.idx=2))
+ AND ((t1.id=j_lj_t3.id AND t3_lj.id IS NULL) OR (t1.id=t3.id AND t3.idx=2));
+SELECT DISTINCT
+ t1.id
+from
+ t1
+ straight_join
+ t2
+ straight_join
+ t3
+ straight_join
+ t1 as j_lj_t2 left join t2 as t2_lj
+ on j_lj_t2.id=t2_lj.id
+ straight_join
+ t1 as j_lj_t3 left join t3 as t3_lj
+ on j_lj_t3.id=t3_lj.id
+WHERE
+ ((t1.id=j_lj_t2.id AND t2_lj.id IS NULL) OR (t1.id=t2.id AND t2.idx=2))
+ AND ((t1.id=j_lj_t3.id AND t3_lj.id IS NULL) OR (t1.id=t3.id AND t3.idx=2));
+drop table t1,t2,t3;
diff --git a/mysql-test/t/empty_table.test b/mysql-test/t/empty_table.test
new file mode 100644
index 00000000000..9ea79ee157f
--- /dev/null
+++ b/mysql-test/t/empty_table.test
@@ -0,0 +1,10 @@
+#
+# Some special cases with empty tables
+#
+
+drop table if exists t1;
+create table t1 (nr int(5) not null auto_increment,b blob,str char(10), primary key (nr));
+select count(*) from t1;
+select * from t1;
+select * from t1 limit 0;
+drop table t1;
diff --git a/mysql-test/t/err000001.test b/mysql-test/t/err000001.test
index f264c0bb172..9957cefff9b 100644
--- a/mysql-test/t/err000001.test
+++ b/mysql-test/t/err000001.test
@@ -1,3 +1,18 @@
-use test;
-drop table if exists foo;
-!$1146 insert into foo values(1);
+#
+# Test some error conditions
+#
+
+drop table if exists t1;
+!$1146 insert into t1 values(1);
+!$1146 delete from t1;
+!$1146 update t1 set a=1;
+create table t1 (a int);
+!$1054 select count(test.t1.b) from t1;
+!$1109 select count(not_existing_database.t1) from t1;
+!$1109 select count(not_existing_database.t1.a) from t1;
+!$1044 select count(not_existing_database.t1.a) from not_existing_database.t1;
+!$1054 select 1 from t1 order by 2;
+!$1054 select 1 from t1 group by 2;
+!$1054 select 1 from t1 order by t1.b;
+!$1054 select count(*),b from t1;
+drop table t1;
diff --git a/mysql-test/t/explain.test b/mysql-test/t/explain.test
new file mode 100644
index 00000000000..31a01ae1360
--- /dev/null
+++ b/mysql-test/t/explain.test
@@ -0,0 +1,19 @@
+#
+# Test of different EXPLAIN's
+
+drop table if exists t1;
+create table t1 (id int not null, str char(10), unique(str));
+insert into t1 values (1, null),(2, null),(3, "foo"),(4, "bar");
+select * from t1 where str is null;
+select * from t1 where str="foo";
+explain select * from t1 where str is null;
+explain select * from t1 where str="foo";
+explain select * from t1 ignore key (str) where str="foo";
+explain select * from t1 use key (str,str) where str="foo";
+
+#The following should give errors
+!$1072 explain select * from t1 use key (str,str,foo) where str="foo";
+!$1072 explain select * from t1 ignore key (str,str,foo) where str="foo";
+drop table t1;
+
+explain select 1;
diff --git a/mysql-test/t/flush_table.test b/mysql-test/t/flush_table.test
new file mode 100644
index 00000000000..a4f12886120
--- /dev/null
+++ b/mysql-test/t/flush_table.test
@@ -0,0 +1,12 @@
+# TODO: Only run this if we have privilege to do flush table
+
+#
+# Test of flush table
+#
+
+#create table t1 (a int not null auto_increment primary key);
+#insert into t1 values(0);
+#lock table t1 read;
+#flush table t1;
+#check table t1;
+#drop table t1;
diff --git a/mysql-test/t/foreign_key.test b/mysql-test/t/foreign_key.test
new file mode 100644
index 00000000000..1afcb546f6a
--- /dev/null
+++ b/mysql-test/t/foreign_key.test
@@ -0,0 +1,20 @@
+#
+# Test syntax of foreign keys
+#
+
+drop table if exists t1;
+create table t1 (
+ a int not null references t2,
+ b int not null references t2 (c),
+ primary key (a,b),
+ foreign key (a) references t3 match full,
+ foreign key (a) references t3 match partial,
+ foreign key (a,b) references t3 (c,d) on delete no action
+ on update no action,
+ foreign key (a,b) references t3 (c,d) on update cascade,
+ foreign key (a,b) references t3 (c,d) on delete set default,
+ foreign key (a,b) references t3 (c,d) on update set null);
+
+create index a on t1 (a);
+create unique index b on t1 (a,b);
+drop table t1;
diff --git a/mysql-test/t/fulltext.test b/mysql-test/t/fulltext.test
new file mode 100644
index 00000000000..ad7c97022f5
--- /dev/null
+++ b/mysql-test/t/fulltext.test
@@ -0,0 +1,11 @@
+#
+# Test of fulltext index
+#
+
+CREATE TABLE t1 (a VARCHAR(200), b TEXT, FULLTEXT (a,b));
+INSERT INTO t1 VALUES('MySQL has now support', 'for full-text search'),('Full-text indexes', 'are called collections'),('Only MyISAM tables','support collections'),('Function MATCH ... AGAINST()','is used to do a search'),('Full-text search in MySQL', 'implements vector space model');
+select * from t1 where MATCH(a,b) AGAINST ("collections");
+select * from t1 where MATCH(a,b) AGAINST ("indexes");
+select * from t1 where MATCH(a,b) AGAINST ("indexes collections");
+delete from t1 where a like "MySQL%";
+drop table t1;
diff --git a/mysql-test/t/crypt.test b/mysql-test/t/func_crypt.test
index 4a499f3d5b7..4a499f3d5b7 100644
--- a/mysql-test/t/crypt.test
+++ b/mysql-test/t/func_crypt.test
diff --git a/mysql-test/t/func_date_add.test b/mysql-test/t/func_date_add.test
new file mode 100644
index 00000000000..c0250c6ece4
--- /dev/null
+++ b/mysql-test/t/func_date_add.test
@@ -0,0 +1,39 @@
+#
+# Test of DATE_ADD
+#
+
+drop table if exists t1;
+CREATE TABLE t1 (
+ visitor_id int(10) unsigned DEFAULT '0' NOT NULL,
+ group_id int(10) unsigned DEFAULT '0' NOT NULL,
+ hits int(10) unsigned DEFAULT '0' NOT NULL,
+ sessions int(10) unsigned DEFAULT '0' NOT NULL,
+ ts timestamp(14),
+ PRIMARY KEY (visitor_id,group_id)
+)/*! type=MyISAM */;
+INSERT INTO t1 VALUES (465931136,7,2,2,20000318160952);
+INSERT INTO t1 VALUES (173865424,2,2,2,20000318233615);
+INSERT INTO t1 VALUES (173865424,8,2,2,20000318233615);
+INSERT INTO t1 VALUES (173865424,39,2,2,20000318233615);
+INSERT INTO t1 VALUES (173865424,7,2,2,20000318233615);
+INSERT INTO t1 VALUES (173865424,3,2,2,20000318233615);
+INSERT INTO t1 VALUES (173865424,6,2,2,20000318233615);
+INSERT INTO t1 VALUES (173865424,60,2,2,20000318233615);
+INSERT INTO t1 VALUES (173865424,1502,2,2,20000318233615);
+INSERT INTO t1 VALUES (48985536,2,2,2,20000319013932);
+INSERT INTO t1 VALUES (48985536,8,2,2,20000319013932);
+INSERT INTO t1 VALUES (48985536,39,2,2,20000319013932);
+INSERT INTO t1 VALUES (48985536,7,2,2,20000319013932);
+INSERT INTO t1 VALUES (465931136,3,2,2,20000318160951);
+INSERT INTO t1 VALUES (465931136,119,1,1,20000318160953);
+INSERT INTO t1 VALUES (465931136,2,1,1,20000318160950);
+INSERT INTO t1 VALUES (465931136,8,1,1,20000318160950);
+INSERT INTO t1 VALUES (465931136,39,1,1,20000318160950);
+INSERT INTO t1 VALUES (1092858576,14,1,1,20000319013445);
+INSERT INTO t1 VALUES (357917728,3,2,2,20000319145026);
+INSERT INTO t1 VALUES (357917728,7,2,2,20000319145027);
+select visitor_id,max(ts) as mts from t1 group by visitor_id
+having mts < DATE_SUB(NOW(),INTERVAL 3 MONTH);
+select visitor_id,max(ts) as mts from t1 group by visitor_id
+having DATE_ADD(mts,INTERVAL 3 MONTH) < NOW();
+drop table t1;
diff --git a/mysql-test/t/equal.test b/mysql-test/t/func_equal.test
index 0d7a4ed9778..0d7a4ed9778 100644
--- a/mysql-test/t/equal.test
+++ b/mysql-test/t/func_equal.test
diff --git a/mysql-test/t/func_group.test b/mysql-test/t/func_group.test
new file mode 100644
index 00000000000..b97afc06340
--- /dev/null
+++ b/mysql-test/t/func_group.test
@@ -0,0 +1,100 @@
+#
+# simple test of all group functions
+#
+
+create table t1 (grp int, a bigint unsigned, c char(10) not null);
+insert into t1 values (1,1,"a");
+insert into t1 values (2,2,"b");
+insert into t1 values (2,3,"c");
+insert into t1 values (3,4,"E");
+insert into t1 values (3,5,"C");
+insert into t1 values (3,6,"D");
+
+# Test of MySQL field extension with and without matching records.
+select a,c,sum(a) from t1 group by a;
+select a,c,sum(a) from t1 where a > 10 group by a;
+select sum(a) from t1 where a > 10;
+select a from t1 order by rand(10);
+select distinct a from t1 order by rand(10);
+select count(distinct a),count(distinct grp) from t1;
+insert into t1 values (null,null,'');
+select count(distinct a),count(distinct grp) from t1;
+
+select sum(a),count(a),avg(a),std(a),bit_or(a),bit_and(a),min(a),max(a),min(c),max(c) from t1;
+select grp, sum(a),count(a),avg(a),std(a),bit_or(a),bit_and(a),min(a),max(a),min(c),max(c) from t1 group by grp;
+select grp, sum(a)+count(a)+avg(a)+std(a)+bit_or(a)+bit_and(a)+min(a)+max(a)+min(c)+max(c) as sum from t1 group by grp;
+
+create table t2 (grp int, a bigint unsigned, c char(10));
+insert into t2 select grp,max(a)+max(grp),max(c) from t1 group by grp;
+replace into t2 select grp, a, c from t1 limit 2,1;
+select * from t2;
+
+drop table t1,t2;
+
+#
+# Problem with std()
+#
+
+CREATE TABLE t1 (id int(11),value1 float(10,2));
+INSERT INTO t1 VALUES (1,0.00),(1,1.00), (1,2.00), (2,10.00), (2,11.00), (2,12.00);
+CREATE TABLE t2 (id int(11),name char(20));
+INSERT INTO t2 VALUES (1,'Set One'),(2,'Set Two');
+select id, avg(value1), std(value1) from t1 group by id;
+select name, avg(value1), std(value1) from t1, t2 where t1.id = t2.id group by t1.id;
+drop table t1,t2;
+
+#
+# Test of bug in left join & avg
+#
+
+create table t1 (id int not null);
+create table t2 (id int not null,rating int null);
+insert into t1 values(1),(2),(3);
+insert into t2 values(1, 3),(2, NULL),(2, NULL),(3, 2),(3, NULL);
+select t1.id, avg(rating) from t1 left join t2 on ( t1.id = t2.id ) group by t1.id;
+drop table t1,t2;
+
+#
+# test of count
+#
+create table t1 (a smallint(6) primary key, c char(10), b text);
+INSERT INTO t1 VALUES (1,'1','1');
+INSERT INTO t1 VALUES (2,'2','2');
+INSERT INTO t1 VALUES (4,'4','4');
+
+select count(*) from t1;
+select count(*) from t1 where a = 1;
+select count(*) from t1 where a = 100;
+select count(*) from t1 where a >= 10;
+select count(a) from t1 where a = 1;
+select count(a) from t1 where a = 100;
+select count(a) from t1 where a >= 10;
+select count(b) from t1 where b >= 2;
+select count(b) from t1 where b >= 10;
+select count(c) from t1 where c = 10;
+drop table t1;
+
+#
+# Test of bug in COUNT(i)*(i+0)
+#
+
+CREATE TABLE t1 (d DATETIME, i INT);
+INSERT INTO t1 VALUES (NOW(), 1);
+SELECT COUNT(i), i, COUNT(i)*i FROM t1 GROUP BY i;
+SELECT COUNT(i), (i+0), COUNT(i)*(i+0) FROM t1 GROUP BY i;
+DROP TABLE t1;
+
+#
+# Another SUM() problem with 3.23.2
+#
+
+create table t1 (
+ num float(5,2),
+ user char(20)
+);
+insert into t1 values (10.3,'nem'),(20.53,'monty'),(30.23,'sinisa');
+insert into t1 values (30.13,'nem'),(20.98,'monty'),(10.45,'sinisa');
+insert into t1 values (5.2,'nem'),(8.64,'monty'),(11.12,'sinisa');
+select sum(num) from t1;
+select sum(num) from t1 group by user;
+drop table t1;
diff --git a/mysql-test/t/func_in.test b/mysql-test/t/func_in.test
new file mode 100644
index 00000000000..6830534e761
--- /dev/null
+++ b/mysql-test/t/func_in.test
@@ -0,0 +1,19 @@
+#
+# test of IN (NULL)
+#
+
+CREATE TABLE t1 (field char(1));
+INSERT INTO t1 VALUES ('A'),(NULL);
+SELECT * from t1 WHERE field IN (NULL);
+SELECT * from t1 WHERE field NOT IN (NULL);
+SELECT * from t1 where field = field;
+SELECT * from t1 where field <=> field;
+DELETE FROM t1 WHERE field NOT IN (NULL);
+SELECT * FROM t1;
+drop table t1;
+
+create table t1 (id int(10) primary key);
+insert into t1 values (1),(2),(3),(4),(5),(6),(7),(8),(9);
+select * from t1 where id in (2,5,9);
+drop table t1;
+
diff --git a/mysql-test/t/func_like.test b/mysql-test/t/func_like.test
new file mode 100644
index 00000000000..d160b04176c
--- /dev/null
+++ b/mysql-test/t/func_like.test
@@ -0,0 +1,10 @@
+#
+# Test of like
+#
+
+create table t1 (a varchar(10), key(a));
+insert into t1 values ("a"),("abc"),("abcd"),("hello"),("test");
+select * from t1 where a like "abc%";
+select * from t1 where a like "test%";
+select * from t1 where a like "te_t";
+drop table t1;
diff --git a/mysql-test/t/func_math.test b/mysql-test/t/func_math.test
new file mode 100644
index 00000000000..f6b4672f91a
--- /dev/null
+++ b/mysql-test/t/func_math.test
@@ -0,0 +1,15 @@
+#
+# Test of math functions
+#
+
+select floor(5.5),floor(-5.5);
+select ceiling(5.5),ceiling(-5.5);
+select truncate(52.64,1),truncate(52.64,2),truncate(52.64,-1),truncate(52.64,-2);
+select round(5.5),round(-5.5);
+select round(5.64,1),round(5.64,2),round(5.64,-1),round(5.64,-2);
+select abs(-10), sign(-5), sign(5), sign(0);
+select log(exp(10)),exp(log(sqrt(10))*2);
+select pow(10,log10(10)),power(2,4);
+select rand(999999),rand();
+select pi(),sin(pi()/2),cos(pi()/2),tan(pi()),cot(1),asin(1),acos(0),atan(1);
+select degrees(pi()),radians(360);
diff --git a/mysql-test/t/func_misc.test b/mysql-test/t/func_misc.test
new file mode 100644
index 00000000000..d48b17e87af
--- /dev/null
+++ b/mysql-test/t/func_misc.test
@@ -0,0 +1,9 @@
+#
+# Testing of misc functions
+#
+
+select format(1.5555,0),format(123.5555,1),format(1234.5555,2),format(12345.5555,3),format(123456.5555,4),format(1234567.5555,5),format("12345.2399",2);
+
+select inet_ntoa(inet_aton("255.255.255.255.255.255.255.255"));
+select inet_aton("255.255.255.255.255"),inet_aton("255.255.1.255"),inet_aton("0.1.255");
+select inet_ntoa(1099511627775),inet_ntoa(4294902271),inet_ntoa(511);
diff --git a/mysql-test/t/func_op.test b/mysql-test/t/func_op.test
new file mode 100644
index 00000000000..778c8406b8d
--- /dev/null
+++ b/mysql-test/t/func_op.test
@@ -0,0 +1,7 @@
+# Description
+# -----------
+# Simple operands and arithmetic grouping
+
+select 1+1,1-1,1+1*2,8/5,8%5,mod(8,5),mod(8,5)|0,-(1+1)*-2;
+select 1 | (1+1),5 & 3,bit_count(7) ;
+select 1 << 32,1 << 63, 1 << 64, 4 >> 2, 4 >> 63, 1<< 63 >> 60;
diff --git a/mysql-test/t/func_regexp.test b/mysql-test/t/func_regexp.test
new file mode 100644
index 00000000000..12341f1a661
--- /dev/null
+++ b/mysql-test/t/func_regexp.test
@@ -0,0 +1,26 @@
+#
+# Some regexp tests
+#
+
+create table t1 (s1 char(64),s2 char(64));
+
+insert into t1 values('aaa','aaa');
+insert into t1 values('aaa|qqq','qqq');
+insert into t1 values('gheis','^[^a-dXYZ]+$');
+insert into t1 values('aab','^aa?b');
+insert into t1 values('Baaan','^Ba*n');
+insert into t1 values('aaa','qqq|aaa');
+insert into t1 values('qqq','qqq|aaa');
+
+insert into t1 values('bbb','qqq|aaa');
+insert into t1 values('bbb','qqq');
+insert into t1 values('aaa','aba');
+
+insert into t1 values(null,'abc');
+insert into t1 values('def',null);
+insert into t1 values(null,null);
+insert into t1 values('ghi','ghi[');
+
+select HIGH_PRIORITY s1 regexp s2 from t1;
+
+drop table t1;
diff --git a/mysql-test/t/func_set.test b/mysql-test/t/func_set.test
new file mode 100644
index 00000000000..cb1aa543d43
--- /dev/null
+++ b/mysql-test/t/func_set.test
@@ -0,0 +1,17 @@
+#
+# Testing if SET and similar functions
+#
+
+select interval(55,10,20,30,40,50,60,70,80,90,100),interval(3,1,1+1,1+1+1+1),field("IBM","NCA","ICL","SUN","IBM","DIGITAL"),field("A","B","C"),elt(2,"ONE","TWO","THREE"),interval(0,1,2,3,4),elt(1,1,2,3)|0,elt(1,1.1,1.2,1.3)+0;
+select find_in_set("b","a,b,c"),find_in_set("c","a,b,c"),find_in_set("dd","a,bbb,dd"),find_in_set("bbb","a,bbb,dd");
+select find_in_set("d","a,b,c"),find_in_set("dd","a,bbb,d"),find_in_set("bb","a,bbb,dd");
+select make_set(0,'a','b','c'),make_set(-1,'a','b','c'),make_set(1,'a','b','c'),make_set(2,'a','b','c'),make_set(1+2,concat('a','b'),'c');
+select make_set(NULL,'a','b','c'),make_set(1|4,'a',NULL,'c'),make_set(1+2,'a',NULL,'c');
+select export_set(9,"Y","N","-",5),export_set(9,"Y","N"),export_set(9,"Y","N","");
+
+#
+# Wrong usage of functions
+#
+select elt(2,1),field(NULL,"a","b","c");
+select find_in_set("","a,b,c"),find_in_set("","a,b,c,"),find_in_set("",",a,b,c");
+select find_in_set("abc","abc"),find_in_set("ab","abc"),find_in_set("abcd","abc");
diff --git a/mysql-test/t/strfunc.test b/mysql-test/t/func_str.test
index 7b49da05614..e5ca1bd1d74 100644
--- a/mysql-test/t/strfunc.test
+++ b/mysql-test/t/func_str.test
@@ -38,3 +38,43 @@ select rpad('abcd',7,'ab'),lpad('abcd',7,'ab');
select rpad('abcd',1,'ab'),lpad('abcd',1,'ab');
select LEAST(NULL,'HARRY','HARRIOT',NULL,'HAROLD'),GREATEST(NULL,'HARRY','HARRIOT',NULL,'HAROLD');
+select least(1,2,3) | greatest(16,32,8), least(5,4)*1,greatest(-1.0,1.0)*1,least(3,2,1)*1.0,greatest(1,1.1,1.0),least("10",9),greatest("A","B","0");
+
+select decode(encode(repeat("a",100000),"monty"),"monty")=repeat("a",100000);
+select decode(encode("abcdef","monty"),"monty")="abcdef";
+
+#
+# Wrong usage of functions
+#
+
+select reverse("");
+select insert("aa",100,1,"b"),insert("aa",1,3,"b"),left("aa",-1),substring("a",1,2);
+select elt(2,1),field(NULL,"a","b","c"),reverse("");
+select locate("a","b",2),locate("","a",1);
+select ltrim("a"),rtrim("a"),trim(BOTH "" from "a"),trim(BOTH " " from "a");
+select concat("1","2")|0,concat("1",".5")+0.0;
+select substring_index("www.tcx.se","",3);
+select length(repeat("a",100000000)),length(repeat("a",1000*64));
+select position("0" in "baaa" in (1)),position("0" in "1" in (1,2,3)),position("sql" in ("mysql"));
+select position(("1" in (1,2,3)) in "01");
+select length(repeat("a",65500)),length(concat(repeat("a",32000),repeat("a",32000))),length(replace("aaaaa","a",concat(repeat("a",10000)))),length(insert(repeat("a",40000),1,30000,repeat("b",50000)));
+select length(repeat("a",1000000)),length(concat(repeat("a",32000),repeat("a",32000),repeat("a",32000))),length(replace("aaaaa","a",concat(repeat("a",32000)))),length(insert(repeat("a",48000),1,1000,repeat("a",48000)));
+
+#
+# Problem med concat
+#
+
+drop table if exists t1;
+create table t1 (Zeit time, Tag tinyint not null, Monat tinyint not null, Jahr smallint not null, index(Tag), index(Monat), index(Jahr) );
+insert into t1 values ("09:26:00",16,9,1998);
+insert into t1 values ("09:26:00",16,9,1998);
+SELECT CONCAT(Jahr,'-',Monat,'-',Tag,' ',Zeit) AS Date,
+ UNIX_TIMESTAMP(CONCAT(Jahr,'-',Monat,'-',Tag,' ',Zeit)) AS Unix
+FROM t1;
+drop table t1;
+
+create table t1 ( domain char(50) );
+insert into t1 VALUES ("hello.de" ), ("test.de" );
+select domain from t1 where concat('@', trim(leading '.' from concat('.', domain))) = '@hello.de';
+select domain from t1 where concat('@', trim(leading '.' from concat('.', domain))) = '@test.de';
+drop table t1;
diff --git a/mysql-test/t/func_system.test b/mysql-test/t/func_system.test
new file mode 100644
index 00000000000..b0bdbe472dd
--- /dev/null
+++ b/mysql-test/t/func_system.test
@@ -0,0 +1,6 @@
+#
+# system functions
+#
+
+select database(),user();
+select version()>="3.23.29";
diff --git a/mysql-test/t/func_test.test b/mysql-test/t/func_test.test
new file mode 100644
index 00000000000..9562ae5f77b
--- /dev/null
+++ b/mysql-test/t/func_test.test
@@ -0,0 +1,26 @@
+#
+# Testing of comparison functions
+#
+select 0=0,1>0,1>=1,1<0,1<=0,1!=0,strcmp("abc","abcd"),strcmp("b","a"),strcmp("a","a") ;
+select "a"<"b","a"<="b","b">="a","b">"a","a"="A","a"<>"b";
+select "a "="A", "A "="a", "a " <= "A b";
+select "abc" like "a%", "abc" not like "%d%", "a%" like "a\%","abc%" like "a%\%","abcd" like "a%b_%d", "a" like "%%a","abcde" like "a%_e","abc" like "abc%";
+select "a" like "%%b","a" like "%%ab","ab" like "a\%", "ab" like "_", "ab" like "ab_", "abc" like "%_d", "abc" like "abc%d";
+select '?' like '|%', '?' like '|%' ESCAPE '|', '%' like '|%', '%' like '|%' ESCAPE '|', '%' like '%';
+select 'abc' like '%c','abcabc' like '%c', "ab" like "", "ab" like "a", "ab" like "ab";
+select "Det här är svenska" regexp "h[[:alpha:]]+r", "aba" regexp "^(a|b)*$";
+select "aba" regexp concat("^","a");
+select !0,NOT 0=1,!(0=0),1 AND 1,1 && 0,0 OR 1,1 || NULL, 1=1 or 1=1 and 1=0;
+select IF(0,"ERROR","this"),IF(1,"is","ERROR"),IF(NULL,"ERROR","a"),IF(1,2,3)|0,IF(1,2.0,3.0)+0 ;
+select 2 between 1 and 3, "monty" between "max" and "my",2=2 and "monty" between "max" and "my" and 3=3;
+select 'b' between 'a' and 'c', 'B' between 'a' and 'c';
+select 2 in (3,2,5,9,5,1),"monty" in ("david","monty","allan"), 1.2 in (1.4,1.2,1.0);
+select -1.49 or -1.49,0.6 or 0.6;
+
+#
+# Wrong usage of functions
+#
+
+select 5 between 0 and 10 between 0 and 1,(5 between 0 and 10) between 0 and 1;
+select 1 and 2 between 2 and 10, 2 between 2 and 10 and 1;
+select 1 and 0 or 2, 2 or 1 and 0;
diff --git a/mysql-test/t/func_time.test b/mysql-test/t/func_time.test
new file mode 100644
index 00000000000..33c62e5a6bf
--- /dev/null
+++ b/mysql-test/t/func_time.test
@@ -0,0 +1,100 @@
+#
+# time functions
+#
+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") ;
+select now()-now(),weekday(curdate())-weekday(now()),unix_timestamp()-unix_timestamp(now());
+select from_unixtime(unix_timestamp("1994-03-02 10:11:12")),from_unixtime(unix_timestamp("1994-03-02 10:11:12"),"%Y-%m-%d %h:%i:%s"),from_unixtime(unix_timestamp("1994-03-02 10:11:12"))+0;
+select sec_to_time(9001),sec_to_time(9001)+0,time_to_sec("15:12:22");
+select now()-curdate()*1000000-curtime();
+select strcmp(current_timestamp(),concat(current_date()," ",current_time()));
+select date_format("1997-01-02 03:04:05", "%M %W %D %Y %y %m %d %h %i %s %w");
+select date_format("1997-01-02", concat("%M %W %D ","%Y %y %m %d %h %i %s %w"));
+select dayofmonth("1997-01-02"),dayofmonth(19970323);
+select month("1997-01-02"),year("98-02-03"),dayofyear("1997-12-31");
+select DAYOFYEAR("1997-03-03"), WEEK("1998-03-03"), QUARTER(980303);
+select HOUR("1997-03-03 23:03:22"), MINUTE("23:03:22"), SECOND(230322);
+select week(19980101),week(19970101),week(19980101,1),week(19970101,1);
+select week(19981231),week(19971231),week(19981231,1),week(19971231,1);
+select week(19950101),week(19950101,1);
+select yearweek('1981-12-31',1),yearweek('1982-01-01',1),yearweek('1982-12-31',1),yearweek('1983-01-01',1);
+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');
+select yearweek('1987-01-01',1),yearweek('1987-01-01');
+
+select dayname("1962-03-03"),dayname("1962-03-03")+0;
+select monthname("1972-03-04"),monthname("1972-03-04")+0;
+select time_format(19980131000000,'%H|%I|%k|%l|%i|%p|%r|%S|%T');
+select time_format(19980131010203,'%H|%I|%k|%l|%i|%p|%r|%S|%T');
+select time_format(19980131131415,'%H|%I|%k|%l|%i|%p|%r|%S|%T');
+select time_format(19980131010015,'%H|%I|%k|%l|%i|%p|%r|%S|%T');
+select date_format(concat('19980131',131415),'%H|%I|%k|%l|%i|%p|%r|%S|%T| %M|%W|%D|%Y|%y|%a|%b|%j|%m|%d|%h|%s|%w');
+select date_format(19980021000000,'%H|%I|%k|%l|%i|%p|%r|%S|%T| %M|%W|%D|%Y|%y|%a|%b|%j|%m|%d|%h|%s|%w');
+select date_add("1997-12-31 23:59:59",INTERVAL 1 SECOND);
+select date_add("1997-12-31 23:59:59",INTERVAL 1 MINUTE);
+select date_add("1997-12-31 23:59:59",INTERVAL 1 HOUR);
+select date_add("1997-12-31 23:59:59",INTERVAL 1 DAY);
+select date_add("1997-12-31 23:59:59",INTERVAL 1 MONTH);
+select date_add("1997-12-31 23:59:59",INTERVAL 1 YEAR);
+select date_add("1997-12-31 23:59:59",INTERVAL "1:1" MINUTE_SECOND);
+select date_add("1997-12-31 23:59:59",INTERVAL "1:1" HOUR_MINUTE);
+select date_add("1997-12-31 23:59:59",INTERVAL "1:1" DAY_HOUR);
+select date_add("1997-12-31 23:59:59",INTERVAL "1 1" YEAR_MONTH);
+select date_add("1997-12-31 23:59:59",INTERVAL "1:1:1" HOUR_SECOND);
+select date_add("1997-12-31 23:59:59",INTERVAL "1 1:1" DAY_MINUTE);
+select date_add("1997-12-31 23:59:59",INTERVAL "1 1:1:1" DAY_SECOND);
+
+select date_sub("1998-01-01 00:00:00",INTERVAL 1 SECOND);
+select date_sub("1998-01-01 00:00:00",INTERVAL 1 MINUTE);
+select date_sub("1998-01-01 00:00:00",INTERVAL 1 HOUR);
+select date_sub("1998-01-01 00:00:00",INTERVAL 1 DAY);
+select date_sub("1998-01-01 00:00:00",INTERVAL 1 MONTH);
+select date_sub("1998-01-01 00:00:00",INTERVAL 1 YEAR);
+select date_sub("1998-01-01 00:00:00",INTERVAL "1:1" MINUTE_SECOND);
+select date_sub("1998-01-01 00:00:00",INTERVAL "1:1" HOUR_MINUTE);
+select date_sub("1998-01-01 00:00:00",INTERVAL "1:1" DAY_HOUR);
+select date_sub("1998-01-01 00:00:00",INTERVAL "1 1" YEAR_MONTH);
+select date_sub("1998-01-01 00:00:00",INTERVAL "1:1:1" HOUR_SECOND);
+select date_sub("1998-01-01 00:00:00",INTERVAL "1 1:1" DAY_MINUTE);
+select date_sub("1998-01-01 00:00:00",INTERVAL "1 1:1:1" DAY_SECOND);
+
+select date_add("1997-12-31 23:59:59",INTERVAL 100000 SECOND);
+select date_add("1997-12-31 23:59:59",INTERVAL -100000 MINUTE);
+select date_add("1997-12-31 23:59:59",INTERVAL 100000 HOUR);
+select date_add("1997-12-31 23:59:59",INTERVAL -100000 DAY);
+select date_add("1997-12-31 23:59:59",INTERVAL 100000 MONTH);
+select date_add("1997-12-31 23:59:59",INTERVAL -100000 YEAR);
+select date_add("1997-12-31 23:59:59",INTERVAL "10000:1" MINUTE_SECOND);
+select date_add("1997-12-31 23:59:59",INTERVAL "-10000:1" HOUR_MINUTE);
+select date_add("1997-12-31 23:59:59",INTERVAL "10000:1" DAY_HOUR);
+select date_add("1997-12-31 23:59:59",INTERVAL "-100 1" YEAR_MONTH);
+select date_add("1997-12-31 23:59:59",INTERVAL "10000:99:99" HOUR_SECOND);
+select date_add("1997-12-31 23:59:59",INTERVAL " -10000 99:99" DAY_MINUTE);
+select date_add("1997-12-31 23:59:59",INTERVAL "10000 99:99:99" DAY_SECOND);
+select "1997-12-31 23:59:59" + INTERVAL 1 SECOND;
+select INTERVAL 1 DAY + "1997-12-31";
+select "1998-01-01 00:00:00" - INTERVAL 1 SECOND;
+
+select date_sub("1998-01-02",INTERVAL 31 DAY);
+select date_add("1997-12-31",INTERVAL 1 SECOND);
+select date_add("1997-12-31",INTERVAL 1 DAY);
+select date_add(NULL,INTERVAL 100000 SECOND);
+select date_add("1997-12-31 23:59:59",INTERVAL NULL SECOND);
+select date_add("1997-12-31 23:59:59",INTERVAL NULL MINUTE_SECOND);
+select date_add("9999-12-31 23:59:59",INTERVAL 1 SECOND);
+select date_sub("0000-00-00 00:00:00",INTERVAL 1 SECOND);
+select date_add('1998-01-30',Interval 1 month);
+select date_add('1998-01-30',Interval '2:1' year_month);
+select date_add('1996-02-29',Interval '1' year);
+select extract(YEAR FROM "1999-01-02 10:11:12");
+select extract(YEAR_MONTH FROM "1999-01-02");
+select extract(DAY FROM "1999-01-02");
+select extract(DAY_HOUR FROM "1999-01-02 10:11:12");
+select extract(DAY_MINUTE FROM "02 10:11:12");
+select extract(DAY_SECOND FROM "225 10:11:12");
+select extract(HOUR FROM "1999-01-02 10:11:12");
+select extract(HOUR_MINUTE FROM "10:11:12");
+select extract(HOUR_SECOND FROM "10:11:12");
+select extract(MINUTE FROM "10:11:12");
+select extract(MINUTE_SECOND FROM "10:11:12");
+select extract(SECOND FROM "1999-01-02 10:11:12");
diff --git a/mysql-test/t/group_by.test b/mysql-test/t/group_by.test
new file mode 100644
index 00000000000..edd3c1fff7e
--- /dev/null
+++ b/mysql-test/t/group_by.test
@@ -0,0 +1,210 @@
+#
+# Test of group (Failed for Lars Hoss <lh@pbm.de>)
+#
+
+CREATE TABLE t1 (
+ spID int(10) unsigned,
+ userID int(10) unsigned,
+ score smallint(5) unsigned,
+ lsg char(40),
+ date date
+);
+
+INSERT INTO t1 VALUES (1,1,1,'','0000-00-00');
+INSERT INTO t1 VALUES (2,2,2,'','0000-00-00');
+INSERT INTO t1 VALUES (2,1,1,'','0000-00-00');
+INSERT INTO t1 VALUES (3,3,3,'','0000-00-00');
+
+CREATE TABLE t2 (
+ userID int(10) unsigned DEFAULT '0' NOT NULL auto_increment,
+ niName char(15),
+ passwd char(8),
+ mail char(50),
+ isAukt enum('N','Y') DEFAULT 'N',
+ vName char(30),
+ nName char(40),
+ adr char(60),
+ plz char(5),
+ ort char(35),
+ land char(20),
+ PRIMARY KEY (userID)
+);
+
+INSERT INTO t2 VALUES (1,'name','pass','mail','Y','v','n','adr','1','1','1');
+INSERT INTO t2 VALUES (2,'name','pass','mail','Y','v','n','adr','1','1','1');
+INSERT INTO t2 VALUES (3,'name','pass','mail','Y','v','n','adr','1','1','1');
+
+SELECT t2.userid, MIN(t1.score) FROM t1, t2 WHERE t1.userID=t2.userID GROUP BY t2.userid;
+SELECT t2.userid, MIN(t1.score) FROM t1, t2 WHERE t1.userID=t2.userID AND t1.spID=2 GROUP BY t2.userid;
+SELECT t2.userid, MIN(t1.score+0.0) FROM t1, t2 WHERE t1.userID=t2.userID AND t1.spID=2 GROUP BY t2.userid;
+
+drop table test.t1,test.t2;
+
+#
+# Bug in GROUP BY, by Nikki Chumakov <nikki@saddam.cityline.ru>
+#
+
+CREATE TABLE t1 (
+ PID int(10) unsigned DEFAULT '0' NOT NULL auto_increment,
+ payDate date DEFAULT '0000-00-00' NOT NULL,
+ recDate datetime DEFAULT '0000-00-00 00:00:00' NOT NULL,
+ URID int(10) unsigned DEFAULT '0' NOT NULL,
+ CRID int(10) unsigned DEFAULT '0' NOT NULL,
+ amount int(10) unsigned DEFAULT '0' NOT NULL,
+ operator int(10) unsigned,
+ method enum('unknown','cash','dealer','check','card','lazy','delayed','test') DEFAULT 'unknown' NOT NULL,
+ DIID int(10) unsigned,
+ reason char(1) binary DEFAULT '' NOT NULL,
+ code_id int(10) unsigned,
+ qty mediumint(8) unsigned DEFAULT '0' NOT NULL,
+ PRIMARY KEY (PID),
+ KEY URID (URID),
+ KEY reason (reason),
+ KEY method (method),
+ KEY payDate (payDate)
+);
+
+INSERT INTO t1 VALUES (1,'1970-01-01','1997-10-17 00:00:00',2529,1,21000,11886,'check',0,'F',16200,6);
+
+!$1056 SELECT COUNT(P.URID),SUM(P.amount),P.method, MIN(PP.recdate+0) > 19980501000000 AS IsNew FROM t1 AS P JOIN t1 as PP WHERE P.URID = PP.URID GROUP BY method,IsNew;
+
+drop table t1;
+
+#
+# Problem with GROUP BY + ORDER BY when no match
+# Tested with locking
+#
+
+CREATE TABLE t1 (
+ cid mediumint(9) DEFAULT '0' NOT NULL auto_increment,
+ firstname varchar(32) DEFAULT '' NOT NULL,
+ surname varchar(32) DEFAULT '' NOT NULL,
+ PRIMARY KEY (cid)
+);
+INSERT INTO t1 VALUES (1,'That','Guy');
+INSERT INTO t1 VALUES (2,'Another','Gent');
+
+CREATE TABLE t2 (
+ call_id mediumint(8) DEFAULT '0' NOT NULL auto_increment,
+ contact_id mediumint(8) DEFAULT '0' NOT NULL,
+ PRIMARY KEY (call_id),
+ KEY contact_id (contact_id)
+);
+
+lock tables t1 read,t2 write;
+
+INSERT INTO t2 VALUES (10,2);
+INSERT INTO t2 VALUES (18,2);
+INSERT INTO t2 VALUES (62,2);
+INSERT INTO t2 VALUES (91,2);
+INSERT INTO t2 VALUES (92,2);
+
+SELECT cid, CONCAT(firstname, ' ', surname), COUNT(call_id) FROM t1 LEFT JOIN t2 ON cid=contact_id WHERE firstname like '%foo%' GROUP BY cid;
+SELECT HIGH_PRIORITY cid, CONCAT(firstname, ' ', surname), COUNT(call_id) FROM t1 LEFT JOIN t2 ON cid=contact_id WHERE firstname like '%foo%' GROUP BY cid ORDER BY surname, firstname;
+
+drop table t1,t2;
+unlock tables;
+
+#
+# Test of group by bug in bugzilla
+#
+
+CREATE TABLE t1 (
+ bug_id mediumint(9) DEFAULT '0' NOT NULL auto_increment,
+ groupset bigint(20) DEFAULT '0' NOT NULL,
+ assigned_to mediumint(9) DEFAULT '0' NOT NULL,
+ bug_file_loc text,
+ bug_severity enum('blocker','critical','major','normal','minor','trivial','enhancement') DEFAULT 'blocker' NOT NULL,
+ bug_status enum('NEW','ASSIGNED','REOPENED','RESOLVED','VERIFIED','CLOSED') DEFAULT 'NEW' NOT NULL,
+ creation_ts datetime DEFAULT '0000-00-00 00:00:00' NOT NULL,
+ delta_ts timestamp(14),
+ short_desc mediumtext,
+ long_desc mediumtext,
+ op_sys enum('All','Windows 3.1','Windows 95','Windows 98','Windows NT','Windows 2000','Linux','other') DEFAULT 'All' NOT NULL,
+ priority enum('P1','P2','P3','P4','P5') DEFAULT 'P1' NOT NULL,
+ product varchar(64) DEFAULT '' NOT NULL,
+ rep_platform enum('All','PC','VTD-8','Other'),
+ reporter mediumint(9) DEFAULT '0' NOT NULL,
+ version varchar(16) DEFAULT '' NOT NULL,
+ component varchar(50) DEFAULT '' NOT NULL,
+ resolution enum('','FIXED','INVALID','WONTFIX','LATER','REMIND','DUPLICATE','WORKSFORME') DEFAULT '' NOT NULL,
+ target_milestone varchar(20) DEFAULT '' NOT NULL,
+ qa_contact mediumint(9) DEFAULT '0' NOT NULL,
+ status_whiteboard mediumtext NOT NULL,
+ votes mediumint(9) DEFAULT '0' NOT NULL,
+ PRIMARY KEY (bug_id),
+ KEY assigned_to (assigned_to),
+ KEY creation_ts (creation_ts),
+ KEY delta_ts (delta_ts),
+ KEY bug_severity (bug_severity),
+ KEY bug_status (bug_status),
+ KEY op_sys (op_sys),
+ KEY priority (priority),
+ KEY product (product),
+ KEY reporter (reporter),
+ KEY version (version),
+ KEY component (component),
+ KEY resolution (resolution),
+ KEY target_milestone (target_milestone),
+ KEY qa_contact (qa_contact),
+ KEY votes (votes)
+);
+
+INSERT INTO t1 VALUES (1,0,0,'','normal','','2000-02-10 09:25:12',20000321114747,'','','Linux','P1','TestProduct','PC',3,'other','TestComponent','','M1',0,'',0);
+INSERT INTO t1 VALUES (9,0,0,'','enhancement','','2000-03-10 11:49:36',20000321114747,'','','All','P5','AAAAA','PC',3,'2.00 CD - Pre','BBBBBBBBBBBBB - conversion','','',0,'',0);
+INSERT INTO t1 VALUES (10,0,0,'','enhancement','','2000-03-10 18:10:16',20000321114747,'','','All','P4','AAAAA','PC',3,'2.00 CD - Pre','BBBBBBBBBBBBB - conversion','','',0,'',0);
+INSERT INTO t1 VALUES (7,0,0,'','critical','','2000-03-09 10:50:21',20000321114747,'','','All','P1','AAAAA','PC',3,'2.00 CD - Pre','BBBBBBBBBBBBB - generic','','',0,'',0);
+INSERT INTO t1 VALUES (6,0,0,'','normal','','2000-03-09 10:42:44',20000321114747,'','','All','P2','AAAAA','PC',3,'2.00 CD - Pre','kkkkkkkkkkk lllllllllll','','',0,'',0);
+INSERT INTO t1 VALUES (8,0,0,'','major','','2000-03-09 11:32:14',20000321114747,'','','All','P3','AAAAA','PC',3,'2.00 CD - Pre','kkkkkkkkkkk lllllllllll','','',0,'',0);
+INSERT INTO t1 VALUES (5,0,0,'','enhancement','','2000-03-09 10:38:59',20000321114747,'','','All','P5','CCC/CCCCCC','PC',5,'7.00','Administration','','',0,'',0);
+INSERT INTO t1 VALUES (4,0,0,'','normal','','2000-03-08 18:32:14',20000321114747,'','','other','P2','TestProduct','Other',3,'other','TestComponent2','','',0,'',0);
+INSERT INTO t1 VALUES (3,0,0,'','normal','','2000-03-08 18:30:52',20000321114747,'','','other','P2','TestProduct','Other',3,'other','TestComponent','','',0,'',0);
+INSERT INTO t1 VALUES (2,0,0,'','enhancement','','2000-03-08 18:24:51',20000321114747,'','','All','P2','TestProduct','Other',4,'other','TestComponent2','','',0,'',0);
+INSERT INTO t1 VALUES (11,0,0,'','blocker','','2000-03-13 09:43:41',20000321114747,'','','All','P2','CCC/CCCCCC','PC',5,'7.00','DDDDDDDDD','','',0,'',0);
+INSERT INTO t1 VALUES (12,0,0,'','normal','','2000-03-13 16:14:31',20000321114747,'','','All','P2','AAAAA','PC',3,'2.00 CD - Pre','kkkkkkkkkkk lllllllllll','','',0,'',0);
+INSERT INTO t1 VALUES (13,0,0,'','normal','','2000-03-15 16:20:44',20000321114747,'','','other','P2','TestProduct','Other',3,'other','TestComponent','','',0,'',0);
+INSERT INTO t1 VALUES (14,0,0,'','blocker','','2000-03-15 18:13:47',20000321114747,'','','All','P1','AAAAA','PC',3,'2.00 CD - Pre','BBBBBBBBBBBBB - generic','','',0,'',0);
+INSERT INTO t1 VALUES (15,0,0,'','minor','','2000-03-16 18:03:28',20000321114747,'','','All','P2','CCC/CCCCCC','Other',5,'7.00','DDDDDDDDD','','',0,'',0);
+INSERT INTO t1 VALUES (16,0,0,'','normal','','2000-03-16 18:33:41',20000321114747,'','','All','P2','CCC/CCCCCC','Other',5,'7.00','Administration','','',0,'',0);
+INSERT INTO t1 VALUES (17,0,0,'','normal','','2000-03-16 18:34:18',20000321114747,'','','All','P2','CCC/CCCCCC','Other',5,'7.00','Administration','','',0,'',0);
+INSERT INTO t1 VALUES (18,0,0,'','normal','','2000-03-16 18:34:56',20000321114747,'','','All','P2','CCC/CCCCCC','Other',5,'7.00','Administration','','',0,'',0);
+INSERT INTO t1 VALUES (19,0,0,'','enhancement','','2000-03-16 18:35:34',20000321114747,'','','All','P2','CCC/CCCCCC','Other',5,'7.00','Administration','','',0,'',0);
+INSERT INTO t1 VALUES (20,0,0,'','enhancement','','2000-03-16 18:36:23',20000321114747,'','','All','P2','CCC/CCCCCC','Other',5,'7.00','Administration','','',0,'',0);
+INSERT INTO t1 VALUES (21,0,0,'','enhancement','','2000-03-16 18:37:23',20000321114747,'','','All','P2','CCC/CCCCCC','Other',5,'7.00','Administration','','',0,'',0);
+INSERT INTO t1 VALUES (22,0,0,'','enhancement','','2000-03-16 18:38:16',20000321114747,'','','All','P2','CCC/CCCCCC','Other',5,'7.00','Administration','','',0,'',0);
+INSERT INTO t1 VALUES (23,0,0,'','normal','','2000-03-16 18:58:12',20000321114747,'','','All','P2','CCC/CCCCCC','Other',5,'7.00','DDDDDDDDD','','',0,'',0);
+INSERT INTO t1 VALUES (24,0,0,'','normal','','2000-03-17 11:08:10',20000321114747,'','','All','P2','AAAAAAAA-AAA','PC',3,'2.8','Web Interface','','',0,'',0);
+INSERT INTO t1 VALUES (25,0,0,'','normal','','2000-03-17 11:10:45',20000321114747,'','','All','P2','AAAAAAAA-AAA','PC',3,'2.8','Web Interface','','',0,'',0);
+INSERT INTO t1 VALUES (26,0,0,'','normal','','2000-03-17 11:15:47',20000321114747,'','','All','P2','AAAAAAAA-AAA','PC',3,'2.8','Web Interface','','',0,'',0);
+INSERT INTO t1 VALUES (27,0,0,'','normal','','2000-03-17 17:45:41',20000321114747,'','','All','P2','CCC/CCCCCC','PC',5,'7.00','DDDDDDDDD','','',0,'',0);
+INSERT INTO t1 VALUES (28,0,0,'','normal','','2000-03-20 09:51:45',20000321114747,'','','Windows NT','P2','TestProduct','PC',8,'other','TestComponent','','',0,'',0);
+INSERT INTO t1 VALUES (29,0,0,'','normal','','2000-03-20 11:15:09',20000321114747,'','','All','P5','AAAAAAAA-AAA','PC',3,'2.8','Web Interface','','',0,'',0);
+CREATE TABLE t2 (
+ value tinytext,
+ program varchar(64),
+ initialowner tinytext NOT NULL,
+ initialqacontact tinytext NOT NULL,
+ description mediumtext NOT NULL
+);
+
+INSERT INTO t2 VALUES ('TestComponent','TestProduct','id0001','','');
+INSERT INTO t2 VALUES ('BBBBBBBBBBBBB - conversion','AAAAA','id0001','','');
+INSERT INTO t2 VALUES ('BBBBBBBBBBBBB - generic','AAAAA','id0001','','');
+INSERT INTO t2 VALUES ('TestComponent2','TestProduct','id0001','','');
+INSERT INTO t2 VALUES ('BBBBBBBBBBBBB - eeeeeeeee','AAAAA','id0001','','');
+INSERT INTO t2 VALUES ('kkkkkkkkkkk lllllllllll','AAAAA','id0001','','');
+INSERT INTO t2 VALUES ('Test Procedures','AAAAA','id0001','','');
+INSERT INTO t2 VALUES ('Documentation','AAAAA','id0003','','');
+INSERT INTO t2 VALUES ('DDDDDDDDD','CCC/CCCCCC','id0002','','');
+INSERT INTO t2 VALUES ('Eeeeeeee Lite','CCC/CCCCCC','id0002','','');
+INSERT INTO t2 VALUES ('Eeeeeeee Full','CCC/CCCCCC','id0002','','');
+INSERT INTO t2 VALUES ('Administration','CCC/CCCCCC','id0002','','');
+INSERT INTO t2 VALUES ('Distribution','CCC/CCCCCC','id0002','','');
+INSERT INTO t2 VALUES ('Setup','CCC/CCCCCC','id0002','','');
+INSERT INTO t2 VALUES ('Unspecified','CCC/CCCCCC','id0002','','');
+INSERT INTO t2 VALUES ('Web Interface','AAAAAAAA-AAA','id0001','','');
+INSERT INTO t2 VALUES ('Host communication','AAAAA','id0001','','');
+select value,description,bug_id from t2 left join t1 on t2.program=t1.product and t2.value=t1.component where program="AAAAA";
+select value,description,COUNT(bug_id) from t2 left join t1 on t2.program=t1.product and t2.value=t1.component where program="AAAAA" group by value;
+
+drop table t1,t2;
diff --git a/mysql-test/t/heap.test b/mysql-test/t/heap.test
new file mode 100644
index 00000000000..cd21aaff77a
--- /dev/null
+++ b/mysql-test/t/heap.test
@@ -0,0 +1,87 @@
+#
+# Test of heap tables.
+#
+
+create table t1 (a int not null,b int not null, primary key (a)) type=heap comment="testing heaps" avg_row_length=100 min_rows=1 max_rows=100;
+insert into t1 values(1,1),(2,2),(3,3),(4,4);
+delete from t1 where a=1 or a=0;
+#show table status like "t1";
+show keys from t1;
+select * from t1;
+select * from t1 where a=4;
+update t1 set b=5 where a=4;
+update t1 set b=b+1 where a>=3;
+replace t1 values (3,3);
+select * from t1;
+alter table t1 add c int not null, add key (c,a);
+drop table t1;
+
+create table t1 (a int not null,b int not null, primary key (a)) type=heap comment="testing heaps";
+insert into t1 values(1,1),(2,2),(3,3),(4,4);
+alter table t1 modify a int not null auto_increment, type=myisam, comment="new myisam table";
+#show table status like "t1";
+select * from t1;
+drop table t1;
+
+create table t1 (a int not null) type=heap;
+insert into t1 values (869751),(736494),(226312),(802616);
+select * from t1 where a > 736494;
+alter table t1 add unique uniq_id(a);
+select * from t1 where a > 736494;
+select * from t1 where a = 736494;
+select * from t1 where a=869751 or a=736494;
+select * from t1 where a in (869751,736494,226312,802616);
+alter table t1 type=myisam;
+explain select * from t1 where a in (869751,736494,226312,802616);
+drop table t1;
+
+create table t1 (x int not null, y int not null, key x(x), unique y(y))
+type=heap;
+insert into t1 values (1,1),(2,2),(1,3),(2,4),(2,5),(2,6);
+select * from t1 where x=1;
+select * from t1,t1 as t2 where t1.x=t2.y;
+explain select * from t1,t1 as t2 where t1.x=t2.y;
+drop table t1;
+
+create table t1 (a int) type=heap;
+insert into t1 values(1);
+select max(a) from t1;
+drop table t1;
+
+CREATE TABLE t1 ( a int not null default 0, b int not null default 0, key(a), key(b) ) TYPE=HEAP;
+insert into t1 values(1,1),(1,2),(2,3),(1,3),(1,4),(1,5),(1,6);
+select * from t1 where a=1;
+insert into t1 values(1,1),(1,2),(2,3),(1,3),(1,4),(1,5),(1,6);
+select * from t1 where a=1;
+drop table t1;
+
+create table t1 (id int unsigned not null, primary key (id)) type=HEAP;
+insert into t1 values(1);
+select max(id) from t1;
+insert into t1 values(2);
+select max(id) from t1;
+replace into t1 values(1);
+drop table t1;
+
+create table t1 (n int) type=heap;
+drop table t1;
+
+create table t1 (n int) type=heap;
+drop table if exists t1;
+
+# Test of non unique index
+
+CREATE table t1(f1 int not null,f2 char(20) not
+null,index(f2)) type=heap;
+INSERT into t1 set f1=12,f2="bill";
+INSERT into t1 set f1=13,f2="bill";
+INSERT into t1 set f1=14,f2="bill";
+INSERT into t1 set f1=15,f2="bill";
+INSERT into t1 set f1=16,f2="ted";
+INSERT into t1 set f1=12,f2="ted";
+INSERT into t1 set f1=12,f2="ted";
+INSERT into t1 set f1=12,f2="ted";
+INSERT into t1 set f1=12,f2="ted";
+delete from t1 where f2="bill";
+select * from t1;
+drop table t1;
diff --git a/mysql-test/t/include/master-slave.inc b/mysql-test/t/include/master-slave.inc
deleted file mode 100644
index 137749912a7..00000000000
--- a/mysql-test/t/include/master-slave.inc
+++ /dev/null
@@ -1,11 +0,0 @@
-connect (master,localhost,root,,test,0,var/tmp/mysql.sock);
-connect (master1,localhost,root,,test,0,var/tmp/mysql.sock);
-connect (slave,localhost,root,,test,0,var/tmp/mysql-slave.sock);
-connect (slave1,localhost,root,,test,0,var/tmp/mysql-slave.sock);
-connection slave;
-!slave stop;
-connection master;
-reset master;
-connection slave;
-reset slave;
-!slave start;
diff --git a/mysql-test/t/ins000001.test b/mysql-test/t/ins000001.test
index 1c40d1ffa8d..4d75b4e7fe3 100644
--- a/mysql-test/t/ins000001.test
+++ b/mysql-test/t/ins000001.test
@@ -1,11 +1,9 @@
use test;
-drop table if exists emails;
-drop table if exists domain;
-drop table if exists domain;
-create table emails (email varchar(50));
-insert into emails values ('sasha@mysql.com'),('monty@mysql.com'),
+drop table if exists t1,t2;
+create table t1 (email varchar(50));
+insert into t1 values ('sasha@mysql.com'),('monty@mysql.com'),
('foo@hotmail.com'),('foo@aol.com'),('bar@aol.com');
-create table domain(id int not null auto_increment primary key,
- domain varchar(50), unique(domain));
-insert into domain (domain) select distinct substring(email, locate('@', email)+1) from emails;
-@r/ins000001.result select * from domain;
+create table t2(id int not null auto_increment primary key,
+ t2 varchar(50), unique(t2));
+insert into t2 (t2) select distinct substring(email, locate('@', email)+1) from t1;
+select * from t2;
diff --git a/mysql-test/t/insert.test b/mysql-test/t/insert.test
new file mode 100644
index 00000000000..cf6f41d454d
--- /dev/null
+++ b/mysql-test/t/insert.test
@@ -0,0 +1,12 @@
+#
+# Test of refering to old values
+#
+
+drop table if exists t1;
+create table t1 (a int not null);
+insert into t1 values (1);
+insert into t1 values (a+2);
+insert into t1 values (a+3);
+insert into t1 values (4),(a+5);
+select * from t1;
+drop table t1;
diff --git a/mysql-test/t/insert_select.test b/mysql-test/t/insert_select.test
new file mode 100644
index 00000000000..17ecb2d5a1f
--- /dev/null
+++ b/mysql-test/t/insert_select.test
@@ -0,0 +1,12 @@
+#
+# Problem with INSERT ... SELECT
+#
+
+drop table if exists t1,t2;
+create table t1 (bandID MEDIUMINT UNSIGNED NOT NULL PRIMARY KEY, payoutID SMALLINT UNSIGNED NOT NULL);
+insert into t1 (bandID,payoutID) VALUES (1,6),(2,6),(3,4),(4,9),(5,10),(6,1),(7,12),(8,12);
+create table t2 (payoutID SMALLINT UNSIGNED NOT NULL PRIMARY KEY);
+insert into t2 (payoutID) SELECT DISTINCT payoutID FROM t1;
+insert into t2 (payoutID) SELECT payoutID+10 FROM t1;
+select * from t2;
+drop table t1,t2;
diff --git a/mysql-test/t/join.test b/mysql-test/t/join.test
new file mode 100644
index 00000000000..156f56a4d42
--- /dev/null
+++ b/mysql-test/t/join.test
@@ -0,0 +1,89 @@
+#
+# This failed for lia Perminov
+#
+
+drop table if exists t1,t2;
+create table t1 (id int primary key);
+create table t2 (id int);
+insert into t1 values (75);
+insert into t1 values (79);
+insert into t1 values (78);
+insert into t1 values (77);
+replace into t1 values (76);
+replace into t1 values (76);
+insert into t1 values (104);
+insert into t1 values (103);
+insert into t1 values (102);
+insert into t1 values (101);
+insert into t1 values (105);
+insert into t1 values (106);
+insert into t1 values (107);
+
+insert into t2 values (107);
+insert into t2 values (75);
+
+select t1.id, t2.id from t1, t2 where t2.id = t1.id;
+select t1.id, count(t2.id) from t1,t2 where t2.id = t1.id group by t1.id;
+select t1.id, count(t2.id) from t1,t2 where t2.id = t1.id group by t2.id;
+
+drop table t1,t2;
+
+#
+# problem with join
+#
+
+CREATE TABLE t1 (
+ id int(11) NOT NULL auto_increment,
+ token varchar(100) DEFAULT '' NOT NULL,
+ count int(11) DEFAULT '0' NOT NULL,
+ qty int(11),
+ phone char(1) DEFAULT '' NOT NULL,
+ timestamp datetime DEFAULT '0000-00-00 00:00:00' NOT NULL,
+ PRIMARY KEY (id),
+ KEY token (token(15)),
+ KEY timestamp (timestamp),
+ UNIQUE token_2 (token(75),count,phone)
+);
+
+INSERT INTO t1 VALUES (21,'e45703b64de71482360de8fec94c3ade',3,7800,'n','1999-12-23 17:22:21');
+INSERT INTO t1 VALUES (22,'e45703b64de71482360de8fec94c3ade',4,5000,'y','1999-12-23 17:22:21');
+INSERT INTO t1 VALUES (18,'346d1cb63c89285b2351f0ca4de40eda',3,13200,'b','1999-12-23 11:58:04');
+INSERT INTO t1 VALUES (17,'ca6ddeb689e1b48a04146b1b5b6f936a',4,15000,'b','1999-12-23 11:36:53');
+INSERT INTO t1 VALUES (16,'ca6ddeb689e1b48a04146b1b5b6f936a',3,13200,'b','1999-12-23 11:36:53');
+INSERT INTO t1 VALUES (26,'a71250b7ed780f6ef3185bfffe027983',5,1500,'b','1999-12-27 09:44:24');
+INSERT INTO t1 VALUES (24,'4d75906f3c37ecff478a1eb56637aa09',3,5400,'y','1999-12-23 17:29:12');
+INSERT INTO t1 VALUES (25,'4d75906f3c37ecff478a1eb56637aa09',4,6500,'y','1999-12-23 17:29:12');
+INSERT INTO t1 VALUES (27,'a71250b7ed780f6ef3185bfffe027983',3,6200,'b','1999-12-27 09:44:24');
+INSERT INTO t1 VALUES (28,'a71250b7ed780f6ef3185bfffe027983',3,5400,'y','1999-12-27 09:44:36');
+INSERT INTO t1 VALUES (29,'a71250b7ed780f6ef3185bfffe027983',4,17700,'b','1999-12-27 09:45:05');
+
+CREATE TABLE t2 (
+ id int(11) NOT NULL auto_increment,
+ category int(11) DEFAULT '0' NOT NULL,
+ county int(11) DEFAULT '0' NOT NULL,
+ state int(11) DEFAULT '0' NOT NULL,
+ phones int(11) DEFAULT '0' NOT NULL,
+ nophones int(11) DEFAULT '0' NOT NULL,
+ PRIMARY KEY (id),
+ KEY category (category,county,state)
+);
+INSERT INTO t2 VALUES (3,2,11,12,5400,7800);
+INSERT INTO t2 VALUES (4,2,25,12,6500,11200);
+INSERT INTO t2 VALUES (5,1,37,6,10000,12000);
+
+select a.id, b.category as catid, b.state as stateid, b.county as
+countyid from t1 a, t2 b where (a.token =
+'a71250b7ed780f6ef3185bfffe027983') and (a.count = b.id);
+select a.id, b.category as catid, b.state as stateid, b.county as
+countyid from t1 a, t2 b where (a.token =
+'a71250b7ed780f6ef3185bfffe027983') and (a.count = b.id) order by a.id;
+
+drop table t1, t2;
+
+#
+# Test of join of many tables.
+
+create table t1 (a int primary key);
+insert into t1 values(1),(2);
+select t1.a from t1 as t1 left join t1 as t2 using (a) left join t1 as t3 using (a) left join t1 as t4 using (a) left join t1 as t5 using (a) left join t1 as t6 using (a) left join t1 as t7 using (a) left join t1 as t8 using (a) left join t1 as t9 using (a) left join t1 as t10 using (a) left join t1 as t11 using (a) left join t1 as t12 using (a) left join t1 as t13 using (a) left join t1 as t14 using (a) left join t1 as t15 using (a) left join t1 as t16 using (a) left join t1 as t17 using (a) left join t1 as t18 using (a) left join t1 as t19 using (a) left join t1 as t20 using (a) left join t1 as t21 using (a) left join t1 as t22 using (a) left join t1 as t23 using (a) left join t1 as t24 using (a) left join t1 as t25 using (a) left join t1 as t26 using (a) left join t1 as t27 using (a) left join t1 as t28 using (a) left join t1 as t29 using (a) left join t1 as t30 using (a) left join t1 as t31 using (a) left join t1 as t32 using (a) left join t1 as t33 using (a) left join t1 as t34 using (a) left join t1 as t35 using (a) left join t1 as t36 using (a) left join t1 as t37 using (a) left join t1 as t38 using (a) left join t1 as t39 using (a) left join t1 as t40 using (a) left join t1 as t41 using (a) left join t1 as t42 using (a) left join t1 as t43 using (a) left join t1 as t44 using (a) left join t1 as t45 using (a) left join t1 as t46 using (a) left join t1 as t47 using (a) left join t1 as t48 using (a) left join t1 as t49 using (a) left join t1 as t50 using (a) left join t1 as t51 using (a) left join t1 as t52 using (a) left join t1 as t53 using (a) left join t1 as t54 using (a) left join t1 as t55 using (a) left join t1 as t56 using (a) left join t1 as t57 using (a) left join t1 as t58 using (a) left join t1 as t59 using (a) left join t1 as t60 using (a);
+drop table t1;
diff --git a/mysql-test/t/join_outer.test b/mysql-test/t/join_outer.test
new file mode 100644
index 00000000000..a93fd5a08ad
--- /dev/null
+++ b/mysql-test/t/join_outer.test
@@ -0,0 +1,395 @@
+#
+# test of left outer join
+#
+
+drop table if exists t1,t2,t3,t4,t5;
+
+CREATE TABLE t1 (
+ grp int(11) default NULL,
+ a bigint(20) unsigned default NULL,
+ c char(10) NOT NULL default ''
+) TYPE=MyISAM;
+INSERT INTO t1 VALUES (1,1,'a'),(2,2,'b'),(2,3,'c'),(3,4,'E'),(3,5,'C'),(3,6,'D'),(NULL,NULL,'');
+create table t2 (id int, a bigint unsigned not null, c char(10), d int, primary key (a));
+insert into t2 values (1,1,"a",1),(3,4,"A",4),(3,5,"B",5),(3,6,"C",6),(4,7,"D",7);
+
+select t1.*,t2.* from t1 JOIN t2 where t1.a=t2.a;
+select t1.*,t2.* from t1 left join t2 on (t1.a=t2.a) order by t1.grp,t1.a,t2.c;
+select t1.*,t2.* from { oj t2 left outer join t1 on (t1.a=t2.a) };
+select t1.*,t2.* from t1 as t0,{ oj t2 left outer join t1 on (t1.a=t2.a) } WHERE t0.a=2;
+select t1.*,t2.* from t1 left join t2 using (a);
+select t1.*,t2.* from t1 left join t2 using (a,c);
+select t1.*,t2.* from t1 left join t2 using (c);
+select t1.*,t2.* from t1 natural left outer join t2;
+
+select t1.*,t2.* from t1 left join t2 on (t1.a=t2.a) where t2.id=3;
+select t1.*,t2.* from t1 left join t2 on (t1.a=t2.a) where t2.id is null;
+
+explain select t1.*,t2.* from t1,t2 where t1.a=t2.a and isnull(t2.a)=1;
+explain select t1.*,t2.* from t1 left join t2 on t1.a=t2.a where isnull(t2.a)=1;
+
+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);
+
+# The next query should rearange the left joins to get this to work
+!$1120 explain select t1.*,t2.*,t3.a from t1 left join t2 on (t3.a=t2.a) left join t1 as t3 on (t1.a=t3.a);
+!$1120 select t1.*,t2.*,t3.a from t1 left join t2 on (t3.a=t2.a) left join t1 as t3 on (t1.a=t3.a);
+
+# The next query should give an error in MySQL
+!$1120 select t1.*,t2.*,t3.a from t1 left join t2 on (t3.a=t2.a) left join t1 as t3 on (t2.a=t3.a);
+
+# Test of inner join
+select t1.*,t2.* from t1 inner join t2 using (a);
+select t1.*,t2.* from t1 inner join t2 on (t1.a=t2.a);
+select t1.*,t2.* from t1 natural join t2;
+
+drop table t1,t2;
+
+#
+# Test of left join bug
+#
+
+CREATE TABLE t1 (
+ usr_id INT unsigned NOT NULL,
+ uniq_id INT unsigned NOT NULL AUTO_INCREMENT,
+ start_num INT unsigned NOT NULL DEFAULT 1,
+ increment INT unsigned NOT NULL DEFAULT 1,
+ PRIMARY KEY (uniq_id),
+ INDEX usr_uniq_idx (usr_id, uniq_id),
+ INDEX uniq_usr_idx (uniq_id, usr_id)
+);
+CREATE TABLE t2 (
+ id INT unsigned NOT NULL DEFAULT 0,
+ usr2_id INT unsigned NOT NULL DEFAULT 0,
+ max INT unsigned NOT NULL DEFAULT 0,
+ c_amount INT unsigned NOT NULL DEFAULT 0,
+ d_max INT unsigned NOT NULL DEFAULT 0,
+ d_num INT unsigned NOT NULL DEFAULT 0,
+ orig_time INT unsigned NOT NULL DEFAULT 0,
+ c_time INT unsigned NOT NULL DEFAULT 0,
+ active ENUM ("no","yes") NOT NULL,
+ PRIMARY KEY (id,usr2_id),
+ INDEX id_idx (id),
+ INDEX usr2_idx (usr2_id)
+);
+INSERT INTO t1 VALUES (3,NULL,0,50),(3,NULL,0,200),(3,NULL,0,25),(3,NULL,0,84676),(3,NULL,0,235),(3,NULL,0,10),(3,NULL,0,3098),(3,NULL,0,2947),(3,NULL,0,8987),(3,NULL,0,8347654),(3,NULL,0,20398),(3,NULL,0,8976),(3,NULL,0,500),(3,NULL,0,198);
+
+#1st select shows that one record is returned with null entries for the right
+#table, when selecting on an id that does not exist in the right table t2
+SELECT t1.usr_id,t1.uniq_id,t1.increment,
+t2.usr2_id,t2.c_amount,t2.max
+FROM t1
+LEFT JOIN t2 ON t2.id = t1.uniq_id
+WHERE t1.uniq_id = 4
+ORDER BY t2.c_amount;
+
+# The same with RIGHT JOIN
+SELECT t1.usr_id,t1.uniq_id,t1.increment,
+t2.usr2_id,t2.c_amount,t2.max
+FROM t2
+RIGHT JOIN t1 ON t2.id = t1.uniq_id
+WHERE t1.uniq_id = 4
+ORDER BY t2.c_amount;
+
+INSERT INTO t2 VALUES (2,3,3000,6000,0,0,746584,837484,'yes');
+!$1062 INSERT INTO t2 VALUES (2,3,3000,6000,0,0,746584,837484,'yes');
+INSERT INTO t2 VALUES (7,3,1000,2000,0,0,746294,937484,'yes');
+
+#3rd select should show that one record is returned with null entries for the
+# right table, when selecting on an id that does not exist in the right table
+# t2 but this select returns an empty set!!!!
+SELECT t1.usr_id,t1.uniq_id,t1.increment,t2.usr2_id,t2.c_amount,t2.max FROM t1 LEFT JOIN t2 ON t2.id = t1.uniq_id WHERE t1.uniq_id = 4 ORDER BY t2.c_amount;
+SELECT t1.usr_id,t1.uniq_id,t1.increment,t2.usr2_id,t2.c_amount,t2.max FROM t1 LEFT JOIN t2 ON t2.id = t1.uniq_id WHERE t1.uniq_id = 4 GROUP BY t2.c_amount;
+# Removing the ORDER BY works:
+SELECT t1.usr_id,t1.uniq_id,t1.increment,t2.usr2_id,t2.c_amount,t2.max FROM t1 LEFT JOIN t2 ON t2.id = t1.uniq_id WHERE t1.uniq_id = 4;
+
+drop table t1,t2;
+
+#
+# Test of LEFT JOIN with const tables (failed for frankie@etsetb.upc.es)
+#
+
+drop table if exists t1,t2,t3,t4;
+CREATE TABLE t1 (
+ cod_asig int(11) DEFAULT '0' NOT NULL,
+ desc_larga_cat varchar(80) DEFAULT '' NOT NULL,
+ desc_larga_cas varchar(80) DEFAULT '' NOT NULL,
+ desc_corta_cat varchar(40) DEFAULT '' NOT NULL,
+ desc_corta_cas varchar(40) DEFAULT '' NOT NULL,
+ cred_total double(3,1) DEFAULT '0.0' NOT NULL,
+ pre_requisit int(11),
+ co_requisit int(11),
+ preco_requisit int(11),
+ PRIMARY KEY (cod_asig)
+);
+
+INSERT INTO t1 VALUES (10360,'asdfggfg','Introduccion a los Ordenadores I','asdfggfg','Introduccio Ordinadors I',6.0,NULL,NULL,NULL);
+INSERT INTO t1 VALUES (10361,'Components i Circuits Electronics I','Componentes y Circuitos Electronicos I','Components i Circuits Electronics I','Comp. i Circ. Electr. I',6.0,NULL,NULL,NULL);
+INSERT INTO t1 VALUES (10362,'Laboratori d`Ordinadors','Laboratorio de Ordenadores','Laboratori d`Ordinadors','Laboratori Ordinadors',4.5,NULL,NULL,NULL);
+INSERT INTO t1 VALUES (10363,'Tecniques de Comunicacio Oral i Escrita','Tecnicas de Comunicacion Oral y Escrita','Tecniques de Comunicacio Oral i Escrita','Tec. Com. Oral i Escrita',4.5,NULL,NULL,NULL);
+INSERT INTO t1 VALUES (11403,'Projecte Fi de Carrera','Proyecto Fin de Carrera','Projecte Fi de Carrera','PFC',9.0,NULL,NULL,NULL);
+INSERT INTO t1 VALUES (11404,'+lgebra lineal','Algebra lineal','+lgebra lineal','+lgebra lineal',15.0,NULL,NULL,NULL);
+INSERT INTO t1 VALUES (11405,'+lgebra lineal','Algebra lineal','+lgebra lineal','+lgebra lineal',18.0,NULL,NULL,NULL);
+INSERT INTO t1 VALUES (11406,'Calcul Infinitesimal','Cßlculo Infinitesimal','Calcul Infinitesimal','Calcul Infinitesimal',15.0,NULL,NULL,NULL);
+
+CREATE TABLE t2 (
+ idAssignatura int(11) DEFAULT '0' NOT NULL,
+ Grup int(11) DEFAULT '0' NOT NULL,
+ Places smallint(6) DEFAULT '0' NOT NULL,
+ PlacesOcupades int(11) DEFAULT '0',
+ PRIMARY KEY (idAssignatura,Grup)
+);
+
+
+INSERT INTO t2 VALUES (10360,12,333,0);
+INSERT INTO t2 VALUES (10361,30,2,0);
+INSERT INTO t2 VALUES (10361,40,3,0);
+INSERT INTO t2 VALUES (10360,45,10,0);
+INSERT INTO t2 VALUES (10362,10,12,0);
+INSERT INTO t2 VALUES (10360,55,2,0);
+INSERT INTO t2 VALUES (10360,70,0,0);
+INSERT INTO t2 VALUES (10360,565656,0,0);
+INSERT INTO t2 VALUES (10360,32767,7,0);
+INSERT INTO t2 VALUES (10360,33,8,0);
+INSERT INTO t2 VALUES (10360,7887,85,0);
+INSERT INTO t2 VALUES (11405,88,8,0);
+INSERT INTO t2 VALUES (10360,0,55,0);
+INSERT INTO t2 VALUES (10360,99,0,0);
+INSERT INTO t2 VALUES (11411,30,10,0);
+INSERT INTO t2 VALUES (11404,0,0,0);
+INSERT INTO t2 VALUES (10362,11,111,0);
+INSERT INTO t2 VALUES (10363,33,333,0);
+INSERT INTO t2 VALUES (11412,55,0,0);
+INSERT INTO t2 VALUES (50003,66,6,0);
+INSERT INTO t2 VALUES (11403,5,0,0);
+INSERT INTO t2 VALUES (11406,11,11,0);
+INSERT INTO t2 VALUES (11410,11410,131,0);
+INSERT INTO t2 VALUES (11416,11416,32767,0);
+INSERT INTO t2 VALUES (11409,0,0,0);
+
+CREATE TABLE t3 (
+ id int(11) DEFAULT '0' NOT NULL auto_increment,
+ dni_pasaporte char(16) DEFAULT '' NOT NULL,
+ idPla int(11) DEFAULT '0' NOT NULL,
+ cod_asig int(11) DEFAULT '0' NOT NULL,
+ any smallint(6) DEFAULT '0' NOT NULL,
+ quatrimestre smallint(6) DEFAULT '0' NOT NULL,
+ estat char(1) DEFAULT 'M' NOT NULL,
+ PRIMARY KEY (id),
+ UNIQUE dni_pasaporte (dni_pasaporte,idPla),
+ UNIQUE dni_pasaporte_2 (dni_pasaporte,idPla,cod_asig,any,quatrimestre)
+);
+
+INSERT INTO t3 VALUES (1,'11111111',1,10362,98,1,'M');
+
+CREATE TABLE t4 (
+ id int(11) DEFAULT '0' NOT NULL auto_increment,
+ papa int(11) DEFAULT '0' NOT NULL,
+ fill int(11) DEFAULT '0' NOT NULL,
+ idPla int(11) DEFAULT '0' NOT NULL,
+ PRIMARY KEY (id),
+ KEY papa (idPla,papa),
+ UNIQUE papa_2 (idPla,papa,fill)
+);
+
+INSERT INTO t4 VALUES (1,-1,10360,1);
+INSERT INTO t4 VALUES (2,-1,10361,1);
+INSERT INTO t4 VALUES (3,-1,10362,1);
+
+SELECT DISTINCT fill,desc_larga_cat,cred_total,Grup,Places,PlacesOcupades FROM t4 LEFT JOIN t3 ON t3.cod_asig=fill AND estat='S' AND dni_pasaporte='11111111' AND t3.idPla=1 , t2,t1 WHERE fill=t1.cod_asig AND Places>PlacesOcupades AND fill=idAssignatura AND t4.idPla=1 AND papa=-1;
+
+SELECT DISTINCT fill,t3.idPla FROM t4 LEFT JOIN t3 ON t3.cod_asig=t4.fill AND t3.estat='S' AND t3.dni_pasaporte='1234' AND t3.idPla=1 ;
+
+INSERT INTO t3 VALUES (3,'1234',1,10360,98,1,'S');
+SELECT DISTINCT fill,t3.idPla FROM t4 LEFT JOIN t3 ON t3.cod_asig=t4.fill AND t3.estat='S' AND t3.dni_pasaporte='1234' AND t3.idPla=1 ;
+
+drop table t1,t2,t3,test.t4;
+
+#
+# Test of IS NULL on AUTO_INCREMENT with LEFT JOIN
+#
+
+CREATE TABLE t1 (
+ id smallint(5) unsigned DEFAULT '0' NOT NULL auto_increment,
+ name char(60) DEFAULT '' NOT NULL,
+ PRIMARY KEY (id)
+);
+INSERT INTO t1 VALUES (1,'Antonio Paz');
+INSERT INTO t1 VALUES (2,'Lilliana Angelovska');
+INSERT INTO t1 VALUES (3,'Thimble Smith');
+
+CREATE TABLE t2 (
+ id smallint(5) unsigned DEFAULT '0' NOT NULL auto_increment,
+ owner smallint(5) unsigned DEFAULT '0' NOT NULL,
+ name char(60),
+ PRIMARY KEY (id)
+);
+INSERT INTO t2 VALUES (1,1,'El Gato');
+INSERT INTO t2 VALUES (2,1,'Perrito');
+INSERT INTO t2 VALUES (3,3,'Happy');
+
+select t1.name, t2.name, t2.id from t1 left join t2 on (t1.id = t2.owner);
+select t1.name, t2.name, t2.id from t1 left join t2 on (t1.id = t2.owner) where t2.id is null;
+explain select t1.name, t2.name, t2.id from t1 left join t2 on (t1.id = t2.owner) where t2.id is null;
+explain select t1.name, t2.name, t2.id from t1 left join t2 on (t1.id = t2.owner) where t2.name is null;
+select count(*) from t1 left join t2 on (t1.id = t2.owner);
+
+select t1.name, t2.name, t2.id from t2 right join t1 on (t1.id = t2.owner);
+select t1.name, t2.name, t2.id from t2 right join t1 on (t1.id = t2.owner) where t2.id is null;
+explain select t1.name, t2.name, t2.id from t2 right join t1 on (t1.id = t2.owner) where t2.id is null;
+explain select t1.name, t2.name, t2.id from t2 right join t1 on (t1.id = t2.owner) where t2.name is null;
+select count(*) from t2 right join t1 on (t1.id = t2.owner);
+
+select t1.name, t2.name, t2.id,t3.id from t2 right join t1 on (t1.id = t2.owner) left join t1 as t3 on t3.id=t2.owner;
+select t1.name, t2.name, t2.id,t3.id from t1 right join t2 on (t1.id = t2.owner) right join t1 as t3 on t3.id=t2.owner;
+select t1.name, t2.name, t2.id, t2.owner, t3.id from t1 left join t2 on (t1.id = t2.owner) right join t1 as t3 on t3.id=t2.owner;
+
+drop table t1,t2;
+
+create table t1 (id int not null, str char(10), index(str));
+insert into t1 values (1, null), (2, null), (3, "foo"), (4, "bar");
+select * from t1 where str is not null;
+select * from t1 where str is null;
+drop table t1;
+
+#
+# Test wrong LEFT JOIN query
+#
+
+CREATE TABLE t1 (
+ t1_id bigint(21) DEFAULT '0' NOT NULL auto_increment,
+ PRIMARY KEY (t1_id)
+);
+CREATE TABLE t2 (
+ t2_id bigint(21) DEFAULT '0' NOT NULL auto_increment,
+ PRIMARY KEY (t2_id)
+);
+CREATE TABLE t3 (
+ t3_id bigint(21) DEFAULT '0' NOT NULL auto_increment,
+ PRIMARY KEY (t3_id)
+);
+CREATE TABLE t4 (
+ seq_0_id bigint(21) DEFAULT '0' NOT NULL,
+ seq_1_id bigint(21) DEFAULT '0' NOT NULL,
+ KEY seq_0_id (seq_0_id),
+ KEY seq_1_id (seq_1_id)
+);
+CREATE TABLE t5 (
+ seq_0_id bigint(21) DEFAULT '0' NOT NULL,
+ seq_1_id bigint(21) DEFAULT '0' NOT NULL,
+ KEY seq_1_id (seq_1_id),
+ KEY seq_0_id (seq_0_id)
+);
+
+insert into t1 values (1);
+insert into t2 values (1);
+insert into t3 values (1);
+insert into t4 values (1,1);
+insert into t5 values (1,1);
+
+!$1120 explain select * from t3 left join t4 on t4.seq_1_id = t2.t2_id left join t1 on t1.t1_id = t4.seq_0_id left join t5 on t5.seq_0_id = t1.t1_id left join t2 on t2.t2_id = t5.seq_1_id where t3.t3_id = 23;
+
+drop table t1,t2,t3,t4,t5;
+
+#
+# Another LEFT JOIN problem
+# (The problem was that the result changed when we added ORDER BY)
+#
+
+create table t1 (n int, m int, o int, key(n));
+create table t2 (n int not null, m int, o int, primary key(n));
+insert into t1 values (1, 2, 11), (1, 2, 7), (2, 2, 8), (1,2,9),(1,3,9);
+insert into t2 values (1, 2, 3),(2, 2, 8), (4,3,9),(3,2,10);
+select t1.*, t2.* from t1 left join t2 on t1.n = t2.n and
+t1.m = t2.m where t1.n = 1;
+select t1.*, t2.* from t1 left join t2 on t1.n = t2.n and
+t1.m = t2.m where t1.n = 1 order by t1.o;
+drop table t1,t2;
+
+# Test bug with NATURAL join:
+
+CREATE TABLE t1 (id1 INT NOT NULL PRIMARY KEY, dat1 CHAR(1), id2 INT);
+INSERT INTO t1 VALUES (1,'a',1);
+INSERT INTO t1 VALUES (2,'b',1);
+INSERT INTO t1 VALUES (3,'c',2);
+
+CREATE TABLE t2 (id2 INT NOT NULL PRIMARY KEY, dat2 CHAR(1));
+INSERT INTO t2 VALUES (1,'x');
+INSERT INTO t2 VALUES (2,'y');
+INSERT INTO t2 VALUES (3,'z');
+
+SELECT t2.id2 FROM t2 LEFT OUTER JOIN t1 ON t1.id2 = t2.id2 WHERE id1 IS NULL;
+SELECT t2.id2 FROM t2 NATURAL LEFT OUTER JOIN t1 WHERE id1 IS NULL;
+
+drop table t1,t2;
+
+create table t1 ( color varchar(20), name varchar(20) );
+insert into t1 values ( 'red', 'apple' );
+insert into t1 values ( 'yellow', 'banana' );
+insert into t1 values ( 'green', 'lime' );
+insert into t1 values ( 'black', 'grape' );
+insert into t1 values ( 'blue', 'blueberry' );
+create table t2 ( count int, color varchar(20) );
+insert into t2 values (10, 'green');
+insert into t2 values (5, 'black');
+insert into t2 values (15, 'white');
+insert into t2 values (7, 'green');
+select * from t1;
+select * from t2;
+select * from t2 natural join t1;
+select t2.count, t1.name from t2 natural join t1;
+select t2.count, t1.name from t2 inner join t1 using (color);
+drop table t1;
+drop table t2;
+
+#
+# Test of LEFT JOIN + GROUP FUNCTIONS within functions:
+#
+
+CREATE TABLE t1 (
+ pcode varchar(8) DEFAULT '' NOT NULL
+);
+INSERT INTO t1 VALUES ('kvw2000'),('kvw2001'),('kvw3000'),('kvw3001'),('kvw3002'),('kvw3500'),('kvw3501'),('kvw3502'),('kvw3800'),('kvw3801'),('kvw3802'),('kvw3900'),('kvw3901'),('kvw3902'),('kvw4000'),('kvw4001'),('kvw4002'),('kvw4200'),('kvw4500'),('kvw5000'),('kvw5001'),('kvw5500'),('kvw5510'),('kvw5600'),('kvw5601'),('kvw6000'),('klw1000'),('klw1020'),('klw1500'),('klw2000'),('klw2001'),('klw2002'),('kld2000'),('klw2500'),('kmw1000'),('kmw1500'),('kmw2000'),('kmw2001'),('kmw2100'),('kmw3000'),('kmw3200');
+CREATE TABLE t2 (
+ pcode varchar(8) DEFAULT '' NOT NULL,
+ KEY pcode (pcode)
+);
+INSERT INTO t2 VALUES ('kvw2000'),('kvw2000'),('kvw2000'),('kvw2000'),('kvw2000'),('kvw2000'),('kvw2000'),('kvw2000'),('kvw2000'),('kvw2000'),('kvw2000'),('kvw2000'),('kvw2000'),('kvw2000'),('kvw2000'),('kvw2000'),('kvw2000'),('kvw2000'),('kvw2000'),('kvw2000'),('kvw2000'),('kvw2000'),('kvw2000'),('kvw2000'),('kvw2000'),('kvw2000'),('kvw3000'),('kvw3000'),('kvw3000'),('kvw3000'),('kvw3000'),('kvw3000'),('kvw3000'),('kvw3000'),('kvw3000'),('kvw3000'),('kvw3000'),('kvw3000'),('kvw3000'),('kvw3000'),('kvw3000'),('kvw3000'),('kvw3000'),('kvw3000'),('kvw3000'),('kvw3000'),('kvw3000'),('kvw3000'),('kvw3000'),('kvw3000'),('kvw3000'),('kvw3000'),('kvw3000'),('kvw3000'),('kvw3000'),('kvw3000'),('kvw3000'),('kvw3000'),('kvw3000'),('kvw3000'),('kvw3000'),('kvw3000'),('kvw3500'),('kvw3500'),('kvw3500'),('kvw3500'),('kvw3500'),('kvw3500'),('kvw3500'),('kvw3500'),('kvw3500'),('kvw3500'),('kvw3500'),('kvw3500'),('kvw3500'),('kvw3500'),('kvw3500'),('kvw3500'),('kvw3500'),('kvw3500'),('kvw3500'),('kvw3500'),('kvw3500'),('kvw3500'),('kvw3500'),('kvw3500'),('kvw3500'),('kvw3500'),('kvw6000'),('kvw6000'),('kld2000');
+
+SELECT t1.pcode, IF(ISNULL(t2.pcode), 0, COUNT(*)) AS count FROM t1
+LEFT JOIN t2 ON t1.pcode = t2.pcode GROUP BY t1.pcode;
+SELECT SQL_BIG_RESULT t1.pcode, IF(ISNULL(t2.pcode), 0, COUNT(*)) AS count FROM t1 LEFT JOIN t2 ON t1.pcode = t2.pcode GROUP BY t1.pcode;
+drop table t1,t2;
+
+#
+# Another left join problem
+#
+
+CREATE TABLE t1 (
+ id int(11),
+ pid int(11),
+ rep_del tinyint(4),
+ KEY id (id),
+ KEY pid (pid)
+);
+INSERT INTO t1 VALUES (1,NULL,NULL);
+INSERT INTO t1 VALUES (2,1,NULL);
+select * from t1 LEFT JOIN t1 t2 ON (t1.id=t2.pid) AND t2.rep_del IS NULL;
+create index rep_del ON t1(rep_del);
+select * from t1 LEFT JOIN t1 t2 ON (t1.id=t2.pid) AND t2.rep_del IS NULL;
+drop table t1;
+
+CREATE TABLE t1 (
+ id int(11) DEFAULT '0' NOT NULL,
+ name tinytext DEFAULT '' NOT NULL,
+ UNIQUE id (id)
+);
+INSERT INTO t1 VALUES (1,'yes'),(2,'no');
+CREATE TABLE t2 (
+ id int(11) DEFAULT '0' NOT NULL,
+ idx int(11) DEFAULT '0' NOT NULL,
+ UNIQUE id (id,idx)
+);
+INSERT INTO t2 VALUES (1,1);
+explain SELECT * from t1 left join t2 on t1.id=t2.id where t2.id IS NULL;
+SELECT * from t1 left join t2 on t1.id=t2.id where t2.id IS NULL;
+drop table t1,t2;
diff --git a/mysql-test/t/key.test b/mysql-test/t/key.test
new file mode 100644
index 00000000000..4be459b0bb7
--- /dev/null
+++ b/mysql-test/t/key.test
@@ -0,0 +1,146 @@
+#
+# This failed for Elizabeth Mattijsen
+#
+
+drop table if exists t1,t2,t3;
+CREATE TABLE t1 (
+ ID CHAR(32) NOT NULL,
+ name CHAR(32) NOT NULL,
+ value CHAR(255),
+ INDEX indexIDname (ID(8),name(8))
+) ;
+
+INSERT INTO t1 VALUES
+('keyword','indexdir','/export/home/local/www/database/indexes/keyword');
+INSERT INTO t1 VALUES ('keyword','urlprefix','text/ /text');
+INSERT INTO t1 VALUES ('keyword','urlmap','/text/ /');
+INSERT INTO t1 VALUES ('keyword','attr','personal employee company');
+INSERT INTO t1 VALUES
+('emailgids','indexdir','/export/home/local/www/database/indexes/emailgids');
+INSERT INTO t1 VALUES ('emailgids','urlprefix','text/ /text');
+INSERT INTO t1 VALUES ('emailgids','urlmap','/text/ /');
+INSERT INTO t1 VALUES ('emailgids','attr','personal employee company');
+
+SELECT value FROM t1 WHERE ID='emailgids' AND name='attr';
+
+drop table t1;
+
+#
+# Problem with many key parts and many or
+#
+
+CREATE TABLE t1 (
+ price int(5) DEFAULT '0' NOT NULL,
+ area varchar(40) DEFAULT '' NOT NULL,
+ type varchar(40) DEFAULT '' NOT NULL,
+ transityes enum('Y','N') DEFAULT 'Y' NOT NULL,
+ shopsyes enum('Y','N') DEFAULT 'Y' NOT NULL,
+ schoolsyes enum('Y','N') DEFAULT 'Y' NOT NULL,
+ petsyes enum('Y','N') DEFAULT 'Y' NOT NULL,
+ KEY price (price,area,type,transityes,shopsyes,schoolsyes,petsyes)
+);
+
+INSERT INTO t1 VALUES (900,'Vancouver','Shared/Roomate','N','N','N','N');
+INSERT INTO t1 VALUES (900,'Vancouver','Shared/Roomate','N','N','N','N');
+INSERT INTO t1 VALUES (900,'Vancouver','Shared/Roomate','','','','');
+INSERT INTO t1 VALUES (900,'Vancouver','Shared/Roomate','Y','Y','Y','Y');
+INSERT INTO t1 VALUES (900,'Vancouver','Shared/Roomate','Y','Y','Y','Y');
+INSERT INTO t1 VALUES (900,'Vancouver','Shared/Roomate','Y','Y','Y','Y');
+INSERT INTO t1 VALUES (900,'Vancouver','Shared/Roomate','Y','Y','Y','Y');
+INSERT INTO t1 VALUES (900,'Vancouver','Shared/Roomate','Y','Y','Y','Y');
+
+ SELECT * FROM t1 WHERE area='Vancouver' and transityes='y' and schoolsyes='y' and ( ((type='1 Bedroom' or type='Studio/Bach') and (price<=500)) or ((type='2 Bedroom') and (price<=550)) or ((type='Shared/Roomate') and (price<=300)) or ((type='Room and Board') and (price<=500)) ) and price <= 400;
+
+drop table t1;
+
+#
+# problem med primary key
+#
+
+CREATE TABLE t1 (program enum('signup','unique','sliding') not null, type enum('basic','sliding','signup'), sites set('mt'), PRIMARY KEY (program));
+# The following should give an error for wrong primary key
+!$1171 ALTER TABLE t1 modify program enum('signup','unique','sliding');
+drop table t1;
+
+#
+# Test of compressed decimal index.
+#
+
+CREATE TABLE t1 (
+ name varchar(50) DEFAULT '' NOT NULL,
+ author varchar(50) DEFAULT '' NOT NULL,
+ category decimal(10,0) DEFAULT '0' NOT NULL,
+ email varchar(50),
+ password varchar(50),
+ proxy varchar(50),
+ bitmap varchar(20),
+ msg varchar(255),
+ urlscol varchar(127),
+ urlhttp varchar(127),
+ timeout decimal(10,0),
+ nbcnx decimal(10,0),
+ creation decimal(10,0),
+ livinguntil decimal(10,0),
+ lang decimal(10,0),
+ type decimal(10,0),
+ subcat decimal(10,0),
+ subtype decimal(10,0),
+ reg char(1),
+ scs varchar(255),
+ capacity decimal(10,0),
+ userISP varchar(50),
+ CCident varchar(50) DEFAULT '' NOT NULL,
+ PRIMARY KEY (name,author,category)
+);
+INSERT INTO t1 VALUES
+('patnom','patauteur',0,'p.favre@cryo-networks.fr',NULL,NULL,'#p2sndnq6ae5g1u6t','essai\nsalut','scol://195.242.78.119:patauteur.patnom',NULL,NULL,NULL,950036174,-882087474,NULL,3,0,3,'1','Pub/patnom/futur_divers.scs',NULL,'pat','CC1');
+INSERT INTO t1 VALUES
+('LeNomDeMonSite','Marc',0,'m.barilley@cryo-networks.fr',NULL,NULL,NULL,NULL,'scol://195.242.78.119:Marc.LeNomDeMonSite',NULL,NULL,NULL,950560434,-881563214,NULL,3,0,3,'1','Pub/LeNomDeMonSite/domus_hibere.scs',NULL,'Marq','CC1');
+select * from t1 where name='patnom' and author='patauteur' and category=0;
+drop table t1;
+
+#
+# Problem with search on partial index
+#
+
+create table t1
+(
+ name_id int not null auto_increment,
+ name blob,
+ INDEX name_idx (name(5)),
+ primary key (name_id)
+);
+
+INSERT t1 VALUES(NULL,'/');
+INSERT t1 VALUES(NULL,'[T,U]_axpby');
+SELECT * FROM t1 WHERE name='[T,U]_axpy';
+SELECT * FROM t1 WHERE name='[T,U]_axpby';
+create table t2
+(
+ name_id int not null auto_increment,
+ name char(255) binary,
+ INDEX name_idx (name(5)),
+ primary key (name_id)
+);
+INSERT t2 select * from t1;
+SELECT * FROM t2 WHERE name='[T,U]_axpy';
+SELECT * FROM t2 WHERE name='[T,U]_axpby';
+drop table t1,t2;
+
+#
+# Test bug with long primary key
+#
+
+create table t1
+(
+ SEQNO numeric(12 ) not null,
+ MOTYPEID numeric(12 ) not null,
+ MOINSTANCEID numeric(12 ) not null,
+ ATTRID numeric(12 ) not null,
+ VALUE varchar(120) not null,
+ primary key (SEQNO, MOTYPEID, MOINSTANCEID, ATTRID, VALUE )
+);
+INSERT INTO t1 VALUES (1, 1, 1, 1, 'a');
+INSERT INTO t1 VALUES (1, 1, 1, 1, 'b');
+!$1062 INSERT INTO t1 VALUES (1, 1, 1, 1, 'a');
+drop table t1;
diff --git a/mysql-test/t/key_diff.test b/mysql-test/t/key_diff.test
new file mode 100644
index 00000000000..60afb5f81a4
--- /dev/null
+++ b/mysql-test/t/key_diff.test
@@ -0,0 +1,19 @@
+#
+# Check on condition on different length keys.
+
+drop table if exists t1;
+CREATE TABLE t1 (
+ a char(5) NOT NULL,
+ b char(4) NOT NULL,
+ KEY (a),
+ KEY (b)
+);
+
+INSERT INTO t1 VALUES ('A','B'),('b','A'),('C','c'),('D','E'),('a','a');
+
+select * from t1,t1 as t2;
+explain select t1.*,t2.* from t1,t1 as t2 where t1.A=t2.B;
+#select t1.*,t2.* from t1,t1 as t2 where t1.A=t2.B;
+select t1.*,t2.* from t1,t1 as t2 where t1.A=t2.B order by binary t1.a,t2.a;
+select * from t1 where a='a';
+drop table t1;
diff --git a/mysql-test/t/key_primary.test b/mysql-test/t/key_primary.test
new file mode 100644
index 00000000000..75dded5d667
--- /dev/null
+++ b/mysql-test/t/key_primary.test
@@ -0,0 +1,14 @@
+#
+# test of primary key conversions
+#
+
+create table t1 (t1 char(3) primary key);
+insert into t1 values("ABC");
+insert into t1 values("ABA");
+insert into t1 values("AB%");
+select * from t1 where t1="ABC";
+select * from t1 where t1="ABCD";
+select * from t1 where t1 like "a_\%";
+describe select * from t1 where t1="ABC";
+describe select * from t1 where t1="ABCD";
+drop table t1;
diff --git a/mysql-test/t/keywords.test b/mysql-test/t/keywords.test
new file mode 100644
index 00000000000..b9a1f34c715
--- /dev/null
+++ b/mysql-test/t/keywords.test
@@ -0,0 +1,10 @@
+#
+# Test keywords as fields
+#
+
+drop table if exists t1;
+create table t1 (time time, date date, timestamp timestamp);
+insert into t1 values ("12:22:22","97:02:03","1997-01-02");
+select * from t1;
+select t1.time+0,t1.date+0,t1.timestamp+0,concat(date," ",time) from t1;
+drop table t1;
diff --git a/mysql-test/t/limit.test b/mysql-test/t/limit.test
new file mode 100644
index 00000000000..ba075f73d37
--- /dev/null
+++ b/mysql-test/t/limit.test
@@ -0,0 +1,19 @@
+#
+# Test of update and delete with limit
+#
+
+drop table if exists t1;
+create table t1 (a int primary key, b int not null);
+insert into t1 () values (); -- Testing default values
+insert into t1 values (1,1),(2,1),(3,1);
+update t1 set a=4 where b=1 limit 1;
+select * from t1;
+update t1 set b=2 where b=1 limit 2;
+select * from t1;
+update t1 set b=4 where b=1;
+select * from t1;
+delete from t1 where b=2 limit 1;
+select * from t1;
+delete from t1 limit 1;
+select * from t1;
+drop table t1;
diff --git a/mysql-test/t/merge.test b/mysql-test/t/merge.test
new file mode 100644
index 00000000000..a4b4b5c8178
--- /dev/null
+++ b/mysql-test/t/merge.test
@@ -0,0 +1,79 @@
+#
+# test of MERGE TABLES
+#
+
+drop table if exists t1,t2,t3;
+create table t1 (a int not null primary key auto_increment, message char(20));
+create table t2 (a int not null primary key auto_increment, message char(20));
+INSERT INTO t1 (message) VALUES ("Testing"),("table"),("t1");
+INSERT INTO t2 (message) VALUES ("Testing"),("table"),("t2");
+create table t3 (a int not null, b char(20), key(a)) type=MERGE UNION=(t1,t2);
+select * from t3;
+select * from t3 order by a desc;
+drop table t3;
+insert into t1 select NULL,message from t2;
+insert into t2 select NULL,message from t1;
+insert into t1 select NULL,message from t2;
+insert into t2 select NULL,message from t1;
+insert into t1 select NULL,message from t2;
+insert into t2 select NULL,message from t1;
+insert into t1 select NULL,message from t2;
+insert into t2 select NULL,message from t1;
+insert into t1 select NULL,message from t2;
+insert into t2 select NULL,message from t1;
+insert into t1 select NULL,message from t2;
+create table t3 (a int not null, b char(20), key(a)) type=MERGE UNION=(t1,t2);
+explain select * from t3 where a < 10;
+explain select * from t3 where a > 10 and a < 20;
+select * from t3 where a = 10;
+select * from t3 where a < 10;
+select * from t3 where a > 10 and a < 20;
+explain select a from t3 order by a desc limit 10;
+select a from t3 order by a desc limit 10;
+select a from t3 order by a desc limit 300,10;
+
+# The following should give errors
+create table t4 (a int not null, b char(10), key(a)) type=MERGE UNION=(t1,t2);
+
+drop table if exists t1,t2,t3,t4;
+
+create table t1 (c char(10)) type=myisam;
+create table t2 (c char(10)) type=myisam;
+create table t3 (c char(10)) union=(t1,t2) type=merge;
+insert into t1 (c) values ('test1');
+insert into t1 (c) values ('test1');
+insert into t1 (c) values ('test1');
+insert into t2 (c) values ('test2');
+insert into t2 (c) values ('test2');
+insert into t2 (c) values ('test2');
+select * from t3;
+select * from t3;
+delete from t3;
+select * from t3;
+select * from t1;
+drop table t3,t2,t1;
+
+#
+# Test 2
+#
+
+CREATE TABLE t1 (incr int not null, othr int not null, primary key(incr));
+CREATE TABLE t2 (incr int not null, othr int not null, primary key(incr));
+CREATE TABLE t3 (incr int not null, othr int not null, primary key(incr))
+TYPE=MERGE UNION=(t1,t2);
+
+SELECT * from t3;
+
+INSERT INTO t1 VALUES ( 1,10),( 3,53),( 5,21),( 7,12),( 9,17);
+INSERT INTO t2 VALUES ( 2,24),( 4,33),( 6,41),( 8,26),( 0,32);
+INSERT INTO t1 VALUES (11,20),(13,43),(15,11),(17,22),(19,37);
+INSERT INTO t2 VALUES (12,25),(14,31),(16,42),(18,27),(10,30);
+
+SELECT * from t3 where incr in (1,2,3,4) order by othr;
+drop table t3,t2,t1;
+
+#
+# Test table without unions
+#
+select * from m;
+
diff --git a/mysql-test/t/mrg000001.test b/mysql-test/t/mrg000001.test
deleted file mode 100644
index eb9f5ebe49e..00000000000
--- a/mysql-test/t/mrg000001.test
+++ /dev/null
@@ -1,21 +0,0 @@
-DROP TABLE IF EXISTS test1;
-DROP TABLE IF EXISTS test2;
-DROP TABLE IF EXISTS test3;
-
-CREATE TABLE test1 (incr int not null, othr int not null, primary key(incr));
-CREATE TABLE test2 (incr int not null, othr int not null, primary key(incr));
-CREATE TABLE test3 (incr int not null, othr int not null, primary key(incr))
-TYPE=MERGE UNION=(test1,test2);
-
-@r/mrg000001.dummy.result SELECT * from test3;
-
-INSERT INTO test1 VALUES ( 1,10),( 3,53),( 5,21),( 7,12),( 9,17);
-INSERT INTO test2 VALUES ( 2,24),( 4,33),( 6,41),( 8,26),( 0,32);
-INSERT INTO test1 VALUES (11,20),(13,43),(15,11),(17,22),(19,37);
-INSERT INTO test2 VALUES (12,25),(14,31),(16,42),(18,27),(10,30);
-
-@r/mrg000001.result SELECT * from test3 where incr in (1,2,3,4) order by othr;
-
-DROP TABLE IF EXISTS test3;
-DROP TABLE IF EXISTS test1;
-DROP TABLE IF EXISTS test2;
diff --git a/mysql-test/t/mrg000002.test b/mysql-test/t/mrg000002.test
deleted file mode 100644
index 88da6311cc1..00000000000
--- a/mysql-test/t/mrg000002.test
+++ /dev/null
@@ -1,2 +0,0 @@
-use test;
-@r/mrg000002.result select * from m;
diff --git a/mysql-test/t/null.test b/mysql-test/t/null.test
new file mode 100644
index 00000000000..f1fe2cf2c9f
--- /dev/null
+++ b/mysql-test/t/null.test
@@ -0,0 +1,22 @@
+#
+# Testing of NULL in a lot of different places
+#
+
+select null,\N,isnull(null),isnull(1/0),isnull(1/0 = null),ifnull(null,1),ifnull(null,"TRUE"),ifnull("TRUE","ERROR"),1/0 is null,1 is not null;
+select 1 | NULL,1 & NULL,1+NULL,1-NULL;
+select NULL=NULL,NULL<>NULL,IFNULL(NULL,1.1)+0,IFNULL(NULL,1) | 0;
+select strcmp("a",NULL),(1<NULL)+0.0,NULL regexp "a",null like "a%","a%" like null;
+select concat("a",NULL),replace(NULL,"a","b"),replace("string","i",NULL),replace("string",NULL,"i"),insert("abc",1,1,NULL),left(NULL,1);
+select repeat("a",0),repeat("ab",5+5),repeat("ab",-1),reverse(NULL);
+select field(NULL,"a","b","c");
+select 2 between null and 1,2 between 3 AND NULL,NULL between 1 and 2,2 between NULL and 3, 2 between 1 AND null;
+SELECT NULL AND NULL, 1 AND NULL, NULL AND 1, NULL OR NULL, 0 OR NULL, NULL OR 0;
+SELECT (NULL OR NULL) IS NULL;
+select NULL AND 0, 0 and NULL;
+select inet_ntoa(null),inet_aton(null),inet_aton("122.256"),inet_aton("122.226."),inet_aton("");
+
+drop table if exists t1;
+create table t1 (x int);
+insert into t1 values (null);
+select * from t1 where x != 0;
+drop table t1;
diff --git a/mysql-test/t/null_key.test b/mysql-test/t/null_key.test
new file mode 100644
index 00000000000..759f4a432da
--- /dev/null
+++ b/mysql-test/t/null_key.test
@@ -0,0 +1,47 @@
+#
+# Check null keys
+
+drop table if exists t1;
+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;
+explain select * from t1 where a is null and b = 2;
+explain select * from t1 where a is null and b = 7;
+explain select * from t1 where a=2 and b = 2;
+explain select * from t1 where a<=>b limit 2;
+explain select * from t1 where (a is null or a > 0 and a < 3) and b < 5 limit 3;
+explain select * from t1 where (a is null or a = 7) and b=7;
+explain select * from t1 where (a is null and b>a) or a is null and b=7 limit 2;
+explain select * from t1 where a is null and b=9 or a is null and b=7 limit 3;
+explain select * from t1 where a > 1 and a < 3 limit 1;
+explain select * from t1 where a > 8 and a < 9;
+select * from t1 where a is null;
+select * from t1 where a is null and b = 7;
+select * from t1 where a<=>b limit 2;
+select * from t1 where (a is null or a > 0 and a < 3) and b < 5 limit 3;
+select * from t1 where (a is null or a > 0 and a < 3) and b > 7 limit 3;
+select * from t1 where (a is null or a = 7) and b=7;
+select * from t1 where a is null and b=9 or a is null and b=7 limit 3;
+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;
+explain select * from t1 where a is null and b = 2 and c=0;
+explain select * from t1 where a is null and b = 7 and c=0;
+explain select * from t1 where a=2 and b = 2;
+explain select * from t1 where a<=>b limit 2;
+explain select * from t1 where (a is null or a > 0 and a < 3) and b < 5 and c=0 limit 3;
+explain select * from t1 where (a is null or a = 7) and b=7 and c=0;
+explain select * from t1 where (a is null and b>a) or a is null and b=7 limit 2;
+explain select * from t1 where a is null and b=9 or a is null and b=7 limit 3;
+explain select * from t1 where a > 1 and a < 3 limit 1;
+explain select * from t1 where a is null and b=7 or a > 1 and a < 3 limit 1;
+explain select * from t1 where a > 8 and a < 9;
+explain select * from t1 where b like "6%";
+select * from t1 where a is null;
+select * from t1 where a is null and b = 7 and c=0;
+select * from t1 where a<=>b limit 2;
+select * from t1 where (a is null or a > 0 and a < 3) and b < 5 limit 3;
+select * from t1 where (a is null or a > 0 and a < 3) and b > 7 limit 3;
+select * from t1 where (a is null or a = 7) and b=7 and c=0;
+select * from t1 where a is null and b=9 or a is null and b=7 limit 3;
+select * from t1 where b like "6%";
+drop table t1;
diff --git a/mysql-test/t/odbc.test b/mysql-test/t/odbc.test
new file mode 100644
index 00000000000..4629a08fd3f
--- /dev/null
+++ b/mysql-test/t/odbc.test
@@ -0,0 +1,17 @@
+#
+# Test some ODBC compatibility
+#
+
+select {fn length("hello")}, { date "1997-10-20" };
+
+#
+# Test retreiving row with last insert_id value.
+#
+
+create table t1 (a int not null auto_increment,b int not null,primary key (a,b));
+insert into t1 SET A=NULL,B=1;
+insert into t1 SET a=null,b=2;
+select * from t1 where a is null and b=2;
+select * from t1 where a is null;
+explain select * from t1 where b is null;
+drop table t1;
diff --git a/mysql-test/t/order_by.test b/mysql-test/t/order_by.test
new file mode 100644
index 00000000000..9e878b21f93
--- /dev/null
+++ b/mysql-test/t/order_by.test
@@ -0,0 +1,167 @@
+#
+# Bug with order by
+#
+
+drop table if exists t1,t2,t3;
+
+CREATE TABLE t1 (
+ id int(6) DEFAULT '0' NOT NULL,
+ idservice int(5),
+ clee char(20) NOT NULL,
+ flag char(1),
+ KEY id (id),
+ PRIMARY KEY (clee)
+);
+
+
+INSERT INTO t1 VALUES (2,4,'6067169d','Y');
+INSERT INTO t1 VALUES (2,5,'606716d1','Y');
+INSERT INTO t1 VALUES (2,1,'606717c1','Y');
+INSERT INTO t1 VALUES (3,1,'6067178d','Y');
+INSERT INTO t1 VALUES (2,6,'60671515','Y');
+INSERT INTO t1 VALUES (2,7,'60671569','Y');
+INSERT INTO t1 VALUES (2,3,'dd','Y');
+
+CREATE TABLE t2 (
+ id int(6) DEFAULT '0' NOT NULL auto_increment,
+ description varchar(40) NOT NULL,
+ idform varchar(40),
+ ordre int(6) unsigned DEFAULT '0' NOT NULL,
+ image varchar(60),
+ PRIMARY KEY (id),
+ KEY id (id,ordre)
+);
+
+#
+# Dumping data for table 't2'
+#
+
+INSERT INTO t2 VALUES (1,'Emettre un appel d''offres','en_construction.html',10,'emettre.gif');
+INSERT INTO t2 VALUES (2,'Emettre des soumissions','en_construction.html',20,'emettre.gif');
+INSERT INTO t2 VALUES (7,'Liste des t2','t2_liste_form.phtml',51060,'link.gif');
+INSERT INTO t2 VALUES (8,'Consulter les soumissions','consulter_soumissions.phtml',200,'link.gif');
+INSERT INTO t2 VALUES (9,'Ajouter un type de materiel','typeMateriel_ajoute_form.phtml',51000,'link.gif');
+INSERT INTO t2 VALUES (10,'Lister/modifier un type de materiel','typeMateriel_liste_form.phtml',51010,'link.gif');
+INSERT INTO t2 VALUES (3,'Créer une fiche de client','clients_ajoute_form.phtml',40000,'link.gif');
+INSERT INTO t2 VALUES (4,'Modifier des clients','en_construction.html',40010,'link.gif');
+INSERT INTO t2 VALUES (5,'Effacer des clients','en_construction.html',40020,'link.gif');
+INSERT INTO t2 VALUES (6,'Ajouter un service','t2_ajoute_form.phtml',51050,'link.gif');
+
+
+select t1.id,t1.idservice,t2.ordre,t2.description from t1, t2 where t1.id = 2 and t1.idservice = t2.id order by t2.ordre;
+
+drop table t1,t2;
+
+#
+# Test of ORDER BY on concat() result
+#
+
+create table t1 (first char(10),last char(10));
+insert into t1 values ("Michael","Widenius");
+insert into t1 values ("Allan","Larsson");
+insert into t1 values ("David","Axmark");
+select concat(first," ",last) as name from t1 order by name;
+select concat(last," ",first) as name from t1 order by name;
+drop table t1;
+
+#
+# bug in distinct + order by
+#
+
+create table t1 (i int);
+insert into t1 values(1),(2),(1),(2),(1),(2),(3);
+select distinct i from t1;
+select distinct i from t1 order by rand(5);
+select distinct i from t1 order by i desc;
+select distinct i from t1 order by 1-i;
+select distinct i from t1 order by mod(i,2);
+drop table t1;
+
+#
+# Order by on first index part
+#
+
+create table t1 (id int not null,col1 int not null,col2 int not null,index(col1));
+insert into t1 values(1,2,2),(2,2,1),(3,1,2),(4,1,1),(5,1,4),(6,2,3),(7,3,1),(8,2,4);
+select * from t1 order by col1,col2;
+select col1 from t1 order by id;
+select col1 as id from t1 order by t1.id;
+select concat(col1) as id from t1 order by t1.id;
+drop table t1;
+
+#
+# Test of order by on field()
+#
+
+CREATE TABLE t1 (id int auto_increment primary key,aika varchar(40),aikakentta timestamp);
+insert into t1 (aika) values ('Keskiviikko');
+insert into t1 (aika) values ('Tiistai');
+insert into t1 (aika) values ('Maanantai');
+insert into t1 (aika) values ('Sunnuntai');
+
+SELECT FIELD(SUBSTRING(t1.aika,1,2),'Ma','Ti','Ke','To','Pe','La','Su') AS test FROM t1 ORDER by test;
+drop table t1;
+
+#
+# Test of ORDER BY on IF
+#
+
+CREATE TABLE t1
+(
+ a int unsigned NOT NULL,
+ b int unsigned NOT NULL,
+ c int unsigned NOT NULL,
+ UNIQUE(a),
+ INDEX(b),
+ INDEX(c)
+);
+
+CREATE TABLE t2
+(
+ c int unsigned NOT NULL,
+ i int unsigned NOT NULL,
+ INDEX(c)
+);
+
+CREATE TABLE t3
+(
+ c int unsigned NOT NULL,
+ v varchar(64),
+ INDEX(c)
+);
+
+INSERT INTO t1 VALUES (1,1,1);
+INSERT INTO t1 VALUES (2,1,2);
+INSERT INTO t1 VALUES (3,2,1);
+INSERT INTO t1 VALUES (4,2,2);
+INSERT INTO t2 VALUES (1,50);
+INSERT INTO t2 VALUES (2,25);
+INSERT INTO t3 VALUES (1,'123 Park Place');
+INSERT INTO t3 VALUES (2,'453 Boardwalk');
+
+SELECT a,b,if(b = 1,i,if(b = 2,v,''))
+FROM t1
+LEFT JOIN t2 USING(c)
+LEFT JOIN t3 ON t3.c = t1.c;
+
+SELECT a,b,if(b = 1,i,if(b = 2,v,''))
+FROM t1
+LEFT JOIN t2 USING(c)
+LEFT JOIN t3 ON t3.c = t1.c
+ORDER BY a;
+
+drop table t1,t2,t3;
+
+#
+# Test of ORDER BY (Bug found by Dean Edmonds)
+#
+
+create table t1 (ID int not null primary key, TransactionID int not null);
+insert into t1 (ID, TransactionID) values (1, 87), (2, 89), (3, 92), (4, 94), (5, 486), (6, 490), (7, 753), (9, 828), (10, 832), (11, 834), (12, 840);
+create table t2 (ID int not null primary key, GroupID int not null);
+ insert into t2 (ID, GroupID) values (87, 87), (89, 89), (92, 92), (94, 94), (486, 486), (490, 490),(753, 753), (828, 828), (832, 832), (834, 834), (840, 840);
+create table t3 (ID int not null primary key, DateOfAction date not null);
+insert into t3 (ID, DateOfAction) values (87, '1999-07-19'), (89, '1999-07-19'), (92, '1999-07-19'), (94, '1999-07-19'), (486, '1999-07-18'), (490, '2000-03-27'), (753, '2000-03-28'), (828, '1999-07-27'), (832, '1999-07-27'),(834, '1999-07-27'), (840, '1999-07-27');
+select t3.DateOfAction, t1.TransactionID from t1 join t2 join t3 where t2.ID = t1.TransactionID and t3.ID = t2.GroupID order by t3.DateOfAction, t1.TransactionID;
+select t3.DateOfAction, t1.TransactionID from t1 join t2 join t3 where t2.ID = t1.TransactionID and t3.ID = t2.GroupID order by t1.TransactionID,t3.DateOfAction;
+drop table t1,t2,t3;
diff --git a/mysql-test/t/outfile.test b/mysql-test/t/outfile.test
new file mode 100644
index 00000000000..c126d221bd2
--- /dev/null
+++ b/mysql-test/t/outfile.test
@@ -0,0 +1,23 @@
+#
+# test of into outfile|dumpfile
+#
+
+# We need to check that we have 'file' privilege.
+
+#drop table if exists t1;
+#create table t1 (`a` blob);
+#insert into t1 values("hello world"),("Hello mars"),(NULL);
+#select * into outfile "/tmp/select-test.1" from t1;
+#select load_file("/tmp/select-test.1");
+#select * into dumpfile "/tmp/select-test.2" from t1 limit 1;
+#select load_file("/tmp/select-test.2");
+#select * into dumpfile "/tmp/select-test.3" from t1 where a is null;
+#select load_file("/tmp/select-test.3");
+#
+## the following should give errors
+#
+#select * into outfile "/tmp/select-test.1" from t1;
+#select * into dumpfile "/tmp/select-test.1" from t1;
+#select * into dumpfile "/tmp/select-test.99" from t1;
+#select load_file("/tmp/select-test.not-exist");
+#drop table t1;
diff --git a/mysql-test/t/raid.test b/mysql-test/t/raid.test
new file mode 100644
index 00000000000..8b608c1069f
--- /dev/null
+++ b/mysql-test/t/raid.test
@@ -0,0 +1,195 @@
+-- require r/have_raid.require
+show variables like "have_raid";
+
+#
+# Test of raided tables
+#
+
+DROP TABLE IF EXISTS t1,t2;
+CREATE TABLE t1 (
+id int unsigned not null auto_increment primary key,
+c char(255) not null
+) RAID_TYPE=STRIPED RAID_CHUNKS=2 RAID_CHUNKSIZE=123;
+INSERT INTO t1 VALUES
+(NULL,'1'),(NULL,'a'),(NULL,'a'),(NULL,'a'),(NULL,'p'),(NULL,'a'),
+(NULL,'2'),(NULL,'b'),(NULL,'a'),(NULL,'a'),(NULL,'q'),(NULL,'a'),
+(NULL,'3'),(NULL,'c'),(NULL,'a'),(NULL,'a'),(NULL,'r'),(NULL,'a'),
+(NULL,'4'),(NULL,'d'),(NULL,'a'),(NULL,'a'),(NULL,'s'),(NULL,'a'),
+(NULL,'5'),(NULL,'e'),(NULL,'a'),(NULL,'a'),(NULL,'t'),(NULL,'a'),
+(NULL,'6'),(NULL,'f'),(NULL,'a'),(NULL,'a'),(NULL,'u'),(NULL,'a'),
+(NULL,'7'),(NULL,'g'),(NULL,'a'),(NULL,'a'),(NULL,'v'),(NULL,'a'),
+(NULL,'8'),(NULL,'h'),(NULL,'a'),(NULL,'a'),(NULL,'w'),(NULL,'a'),
+(NULL,'9'),(NULL,'i'),(NULL,'a'),(NULL,'a'),(NULL,'x'),(NULL,'a'),
+(NULL,'0'),(NULL,'j'),(NULL,'a'),(NULL,'a'),(NULL,'y'),(NULL,'a'),
+(NULL,'1'),(NULL,'k'),(NULL,'a'),(NULL,'a'),(NULL,'z'),(NULL,'a'),
+(NULL,'2'),(NULL,'l'),(NULL,'a'),(NULL,'a'),(NULL,'/'),(NULL,'a'),
+(NULL,'3'),(NULL,'m'),(NULL,'a'),(NULL,'a'),(NULL,'*'),(NULL,'a'),
+(NULL,'4'),(NULL,'n'),(NULL,'a'),(NULL,'a'),(NULL,'+'),(NULL,'a'),
+(NULL,'5'),(NULL,'o'),(NULL,'a'),(NULL,'a'),(NULL,'?'),(NULL,'a');
+INSERT INTO t1 VALUES
+(NULL,'1'),(NULL,'a'),(NULL,'a'),(NULL,'a'),(NULL,'p'),(NULL,'a'),
+(NULL,'2'),(NULL,'b'),(NULL,'a'),(NULL,'a'),(NULL,'q'),(NULL,'a'),
+(NULL,'3'),(NULL,'c'),(NULL,'a'),(NULL,'a'),(NULL,'r'),(NULL,'a'),
+(NULL,'4'),(NULL,'d'),(NULL,'a'),(NULL,'a'),(NULL,'s'),(NULL,'a'),
+(NULL,'5'),(NULL,'e'),(NULL,'a'),(NULL,'a'),(NULL,'t'),(NULL,'a'),
+(NULL,'6'),(NULL,'f'),(NULL,'a'),(NULL,'a'),(NULL,'u'),(NULL,'a'),
+(NULL,'7'),(NULL,'g'),(NULL,'a'),(NULL,'a'),(NULL,'v'),(NULL,'a'),
+(NULL,'8'),(NULL,'h'),(NULL,'a'),(NULL,'a'),(NULL,'w'),(NULL,'a'),
+(NULL,'9'),(NULL,'i'),(NULL,'a'),(NULL,'a'),(NULL,'x'),(NULL,'a'),
+(NULL,'0'),(NULL,'j'),(NULL,'a'),(NULL,'a'),(NULL,'y'),(NULL,'a'),
+(NULL,'1'),(NULL,'k'),(NULL,'a'),(NULL,'a'),(NULL,'z'),(NULL,'a'),
+(NULL,'2'),(NULL,'l'),(NULL,'a'),(NULL,'a'),(NULL,'/'),(NULL,'a'),
+(NULL,'3'),(NULL,'m'),(NULL,'a'),(NULL,'a'),(NULL,'*'),(NULL,'a'),
+(NULL,'4'),(NULL,'n'),(NULL,'a'),(NULL,'a'),(NULL,'+'),(NULL,'a'),
+(NULL,'5'),(NULL,'o'),(NULL,'a'),(NULL,'a'),(NULL,'?'),(NULL,'a');
+INSERT INTO t1 VALUES
+(NULL,'1'),(NULL,'a'),(NULL,'a'),(NULL,'a'),(NULL,'p'),(NULL,'a'),
+(NULL,'2'),(NULL,'b'),(NULL,'a'),(NULL,'a'),(NULL,'q'),(NULL,'a'),
+(NULL,'3'),(NULL,'c'),(NULL,'a'),(NULL,'a'),(NULL,'r'),(NULL,'a'),
+(NULL,'4'),(NULL,'d'),(NULL,'a'),(NULL,'a'),(NULL,'s'),(NULL,'a'),
+(NULL,'5'),(NULL,'e'),(NULL,'a'),(NULL,'a'),(NULL,'t'),(NULL,'a'),
+(NULL,'6'),(NULL,'f'),(NULL,'a'),(NULL,'a'),(NULL,'u'),(NULL,'a'),
+(NULL,'7'),(NULL,'g'),(NULL,'a'),(NULL,'a'),(NULL,'v'),(NULL,'a'),
+(NULL,'8'),(NULL,'h'),(NULL,'a'),(NULL,'a'),(NULL,'w'),(NULL,'a'),
+(NULL,'9'),(NULL,'i'),(NULL,'a'),(NULL,'a'),(NULL,'x'),(NULL,'a'),
+(NULL,'0'),(NULL,'j'),(NULL,'a'),(NULL,'a'),(NULL,'y'),(NULL,'a'),
+(NULL,'1'),(NULL,'k'),(NULL,'a'),(NULL,'a'),(NULL,'z'),(NULL,'a'),
+(NULL,'2'),(NULL,'l'),(NULL,'a'),(NULL,'a'),(NULL,'/'),(NULL,'a'),
+(NULL,'3'),(NULL,'m'),(NULL,'a'),(NULL,'a'),(NULL,'*'),(NULL,'a'),
+(NULL,'4'),(NULL,'n'),(NULL,'a'),(NULL,'a'),(NULL,'+'),(NULL,'a'),
+(NULL,'5'),(NULL,'o'),(NULL,'a'),(NULL,'a'),(NULL,'?'),(NULL,'a');
+INSERT INTO t1 VALUES
+(NULL,'1'),(NULL,'a'),(NULL,'a'),(NULL,'a'),(NULL,'p'),(NULL,'a'),
+(NULL,'2'),(NULL,'b'),(NULL,'a'),(NULL,'a'),(NULL,'q'),(NULL,'a'),
+(NULL,'3'),(NULL,'c'),(NULL,'a'),(NULL,'a'),(NULL,'r'),(NULL,'a'),
+(NULL,'4'),(NULL,'d'),(NULL,'a'),(NULL,'a'),(NULL,'s'),(NULL,'a'),
+(NULL,'5'),(NULL,'e'),(NULL,'a'),(NULL,'a'),(NULL,'t'),(NULL,'a'),
+(NULL,'6'),(NULL,'f'),(NULL,'a'),(NULL,'a'),(NULL,'u'),(NULL,'a'),
+(NULL,'7'),(NULL,'g'),(NULL,'a'),(NULL,'a'),(NULL,'v'),(NULL,'a'),
+(NULL,'8'),(NULL,'h'),(NULL,'a'),(NULL,'a'),(NULL,'w'),(NULL,'a'),
+(NULL,'9'),(NULL,'i'),(NULL,'a'),(NULL,'a'),(NULL,'x'),(NULL,'a'),
+(NULL,'0'),(NULL,'j'),(NULL,'a'),(NULL,'a'),(NULL,'y'),(NULL,'a'),
+(NULL,'1'),(NULL,'k'),(NULL,'a'),(NULL,'a'),(NULL,'z'),(NULL,'a'),
+(NULL,'2'),(NULL,'l'),(NULL,'a'),(NULL,'a'),(NULL,'/'),(NULL,'a'),
+(NULL,'3'),(NULL,'m'),(NULL,'a'),(NULL,'a'),(NULL,'*'),(NULL,'a'),
+(NULL,'4'),(NULL,'n'),(NULL,'a'),(NULL,'a'),(NULL,'+'),(NULL,'a'),
+(NULL,'5'),(NULL,'o'),(NULL,'a'),(NULL,'a'),(NULL,'?'),(NULL,'a');
+INSERT INTO t1 VALUES
+(NULL,'1'),(NULL,'a'),(NULL,'a'),(NULL,'a'),(NULL,'p'),(NULL,'a'),
+(NULL,'2'),(NULL,'b'),(NULL,'a'),(NULL,'a'),(NULL,'q'),(NULL,'a'),
+(NULL,'3'),(NULL,'c'),(NULL,'a'),(NULL,'a'),(NULL,'r'),(NULL,'a'),
+(NULL,'4'),(NULL,'d'),(NULL,'a'),(NULL,'a'),(NULL,'s'),(NULL,'a'),
+(NULL,'5'),(NULL,'e'),(NULL,'a'),(NULL,'a'),(NULL,'t'),(NULL,'a'),
+(NULL,'6'),(NULL,'f'),(NULL,'a'),(NULL,'a'),(NULL,'u'),(NULL,'a'),
+(NULL,'7'),(NULL,'g'),(NULL,'a'),(NULL,'a'),(NULL,'v'),(NULL,'a'),
+(NULL,'8'),(NULL,'h'),(NULL,'a'),(NULL,'a'),(NULL,'w'),(NULL,'a'),
+(NULL,'9'),(NULL,'i'),(NULL,'a'),(NULL,'a'),(NULL,'x'),(NULL,'a'),
+(NULL,'0'),(NULL,'j'),(NULL,'a'),(NULL,'a'),(NULL,'y'),(NULL,'a'),
+(NULL,'1'),(NULL,'k'),(NULL,'a'),(NULL,'a'),(NULL,'z'),(NULL,'a'),
+(NULL,'2'),(NULL,'l'),(NULL,'a'),(NULL,'a'),(NULL,'/'),(NULL,'a'),
+(NULL,'3'),(NULL,'m'),(NULL,'a'),(NULL,'a'),(NULL,'*'),(NULL,'a'),
+(NULL,'4'),(NULL,'n'),(NULL,'a'),(NULL,'a'),(NULL,'+'),(NULL,'a'),
+(NULL,'5'),(NULL,'o'),(NULL,'a'),(NULL,'a'),(NULL,'?'),(NULL,'a');
+select count(*) from t1;
+ALTER TABLE t1 ADD COLUMN x INT UNSIGNED NOT NULL;
+ALTER TABLE t1 ADD KEY c (c);
+ALTER TABLE t1 DROP KEY c;
+ALTER TABLE t1 DROP COLUMN x;
+ALTER TABLE t1 RENAME t2;
+select count(*) from t2;
+DROP TABLE t2;
+/* variable rows */
+DROP TABLE IF EXISTS t2;
+CREATE TABLE t1 (
+id int unsigned not null auto_increment primary key,
+c varchar(255) not null
+) RAID_TYPE=STRIPED RAID_CHUNKS=5 RAID_CHUNKSIZE=121;
+INSERT INTO t1 VALUES
+(NULL,'1'),(NULL,'a'),(NULL,'a'),(NULL,'a'),(NULL,'p'),(NULL,'a'),
+(NULL,'2'),(NULL,'b'),(NULL,'a'),(NULL,'a'),(NULL,'q'),(NULL,'a'),
+(NULL,'3'),(NULL,'c'),(NULL,'a'),(NULL,'a'),(NULL,'r'),(NULL,'a'),
+(NULL,'4'),(NULL,'d'),(NULL,'a'),(NULL,'a'),(NULL,'s'),(NULL,'a'),
+(NULL,'5'),(NULL,'e'),(NULL,'a'),(NULL,'a'),(NULL,'t'),(NULL,'a'),
+(NULL,'6'),(NULL,'f'),(NULL,'a'),(NULL,'a'),(NULL,'u'),(NULL,'a'),
+(NULL,'7'),(NULL,'g'),(NULL,'a'),(NULL,'a'),(NULL,'v'),(NULL,'a'),
+(NULL,'8'),(NULL,'h'),(NULL,'a'),(NULL,'a'),(NULL,'w'),(NULL,'a'),
+(NULL,'9'),(NULL,'i'),(NULL,'a'),(NULL,'a'),(NULL,'x'),(NULL,'a'),
+(NULL,'0'),(NULL,'j'),(NULL,'a'),(NULL,'a'),(NULL,'y'),(NULL,'a'),
+(NULL,'1'),(NULL,'k'),(NULL,'a'),(NULL,'a'),(NULL,'z'),(NULL,'a'),
+(NULL,'2'),(NULL,'l'),(NULL,'a'),(NULL,'a'),(NULL,'/'),(NULL,'a'),
+(NULL,'3'),(NULL,'m'),(NULL,'a'),(NULL,'a'),(NULL,'*'),(NULL,'a'),
+(NULL,'4'),(NULL,'n'),(NULL,'a'),(NULL,'a'),(NULL,'+'),(NULL,'a'),
+(NULL,'5'),(NULL,'o'),(NULL,'a'),(NULL,'a'),(NULL,'?'),(NULL,'a');
+INSERT INTO t1 VALUES
+(NULL,'1'),(NULL,'a'),(NULL,'a'),(NULL,'a'),(NULL,'p'),(NULL,'a'),
+(NULL,'2'),(NULL,'b'),(NULL,'a'),(NULL,'a'),(NULL,'q'),(NULL,'a'),
+(NULL,'3'),(NULL,'c'),(NULL,'a'),(NULL,'a'),(NULL,'r'),(NULL,'a'),
+(NULL,'4'),(NULL,'d'),(NULL,'a'),(NULL,'a'),(NULL,'s'),(NULL,'a'),
+(NULL,'5'),(NULL,'e'),(NULL,'a'),(NULL,'a'),(NULL,'t'),(NULL,'a'),
+(NULL,'6'),(NULL,'f'),(NULL,'a'),(NULL,'a'),(NULL,'u'),(NULL,'a'),
+(NULL,'7'),(NULL,'g'),(NULL,'a'),(NULL,'a'),(NULL,'v'),(NULL,'a'),
+(NULL,'8'),(NULL,'h'),(NULL,'a'),(NULL,'a'),(NULL,'w'),(NULL,'a'),
+(NULL,'9'),(NULL,'i'),(NULL,'a'),(NULL,'a'),(NULL,'x'),(NULL,'a'),
+(NULL,'0'),(NULL,'j'),(NULL,'a'),(NULL,'a'),(NULL,'y'),(NULL,'a'),
+(NULL,'1'),(NULL,'k'),(NULL,'a'),(NULL,'a'),(NULL,'z'),(NULL,'a'),
+(NULL,'2'),(NULL,'l'),(NULL,'a'),(NULL,'a'),(NULL,'/'),(NULL,'a'),
+(NULL,'3'),(NULL,'m'),(NULL,'a'),(NULL,'a'),(NULL,'*'),(NULL,'a'),
+(NULL,'4'),(NULL,'n'),(NULL,'a'),(NULL,'a'),(NULL,'+'),(NULL,'a'),
+(NULL,'5'),(NULL,'o'),(NULL,'a'),(NULL,'a'),(NULL,'?'),(NULL,'a');
+INSERT INTO t1 VALUES
+(NULL,'1'),(NULL,'a'),(NULL,'a'),(NULL,'a'),(NULL,'p'),(NULL,'a'),
+(NULL,'2'),(NULL,'b'),(NULL,'a'),(NULL,'a'),(NULL,'q'),(NULL,'a'),
+(NULL,'3'),(NULL,'c'),(NULL,'a'),(NULL,'a'),(NULL,'r'),(NULL,'a'),
+(NULL,'4'),(NULL,'d'),(NULL,'a'),(NULL,'a'),(NULL,'s'),(NULL,'a'),
+(NULL,'5'),(NULL,'e'),(NULL,'a'),(NULL,'a'),(NULL,'t'),(NULL,'a'),
+(NULL,'6'),(NULL,'f'),(NULL,'a'),(NULL,'a'),(NULL,'u'),(NULL,'a'),
+(NULL,'7'),(NULL,'g'),(NULL,'a'),(NULL,'a'),(NULL,'v'),(NULL,'a'),
+(NULL,'8'),(NULL,'h'),(NULL,'a'),(NULL,'a'),(NULL,'w'),(NULL,'a'),
+(NULL,'9'),(NULL,'i'),(NULL,'a'),(NULL,'a'),(NULL,'x'),(NULL,'a'),
+(NULL,'0'),(NULL,'j'),(NULL,'a'),(NULL,'a'),(NULL,'y'),(NULL,'a'),
+(NULL,'1'),(NULL,'k'),(NULL,'a'),(NULL,'a'),(NULL,'z'),(NULL,'a'),
+(NULL,'2'),(NULL,'l'),(NULL,'a'),(NULL,'a'),(NULL,'/'),(NULL,'a'),
+(NULL,'3'),(NULL,'m'),(NULL,'a'),(NULL,'a'),(NULL,'*'),(NULL,'a'),
+(NULL,'4'),(NULL,'n'),(NULL,'a'),(NULL,'a'),(NULL,'+'),(NULL,'a'),
+(NULL,'5'),(NULL,'o'),(NULL,'a'),(NULL,'a'),(NULL,'?'),(NULL,'a');
+INSERT INTO t1 VALUES
+(NULL,'1'),(NULL,'a'),(NULL,'a'),(NULL,'a'),(NULL,'p'),(NULL,'a'),
+(NULL,'2'),(NULL,'b'),(NULL,'a'),(NULL,'a'),(NULL,'q'),(NULL,'a'),
+(NULL,'3'),(NULL,'c'),(NULL,'a'),(NULL,'a'),(NULL,'r'),(NULL,'a'),
+(NULL,'4'),(NULL,'d'),(NULL,'a'),(NULL,'a'),(NULL,'s'),(NULL,'a'),
+(NULL,'5'),(NULL,'e'),(NULL,'a'),(NULL,'a'),(NULL,'t'),(NULL,'a'),
+(NULL,'6'),(NULL,'f'),(NULL,'a'),(NULL,'a'),(NULL,'u'),(NULL,'a'),
+(NULL,'7'),(NULL,'g'),(NULL,'a'),(NULL,'a'),(NULL,'v'),(NULL,'a'),
+(NULL,'8'),(NULL,'h'),(NULL,'a'),(NULL,'a'),(NULL,'w'),(NULL,'a'),
+(NULL,'9'),(NULL,'i'),(NULL,'a'),(NULL,'a'),(NULL,'x'),(NULL,'a'),
+(NULL,'0'),(NULL,'j'),(NULL,'a'),(NULL,'a'),(NULL,'y'),(NULL,'a'),
+(NULL,'1'),(NULL,'k'),(NULL,'a'),(NULL,'a'),(NULL,'z'),(NULL,'a'),
+(NULL,'2'),(NULL,'l'),(NULL,'a'),(NULL,'a'),(NULL,'/'),(NULL,'a'),
+(NULL,'3'),(NULL,'m'),(NULL,'a'),(NULL,'a'),(NULL,'*'),(NULL,'a'),
+(NULL,'4'),(NULL,'n'),(NULL,'a'),(NULL,'a'),(NULL,'+'),(NULL,'a'),
+(NULL,'5'),(NULL,'o'),(NULL,'a'),(NULL,'a'),(NULL,'?'),(NULL,'a');
+INSERT INTO t1 VALUES
+(NULL,'1'),(NULL,'a'),(NULL,'a'),(NULL,'a'),(NULL,'p'),(NULL,'a'),
+(NULL,'2'),(NULL,'b'),(NULL,'a'),(NULL,'a'),(NULL,'q'),(NULL,'a'),
+(NULL,'3'),(NULL,'c'),(NULL,'a'),(NULL,'a'),(NULL,'r'),(NULL,'a'),
+(NULL,'4'),(NULL,'d'),(NULL,'a'),(NULL,'a'),(NULL,'s'),(NULL,'a'),
+(NULL,'5'),(NULL,'e'),(NULL,'a'),(NULL,'a'),(NULL,'t'),(NULL,'a'),
+(NULL,'6'),(NULL,'f'),(NULL,'a'),(NULL,'a'),(NULL,'u'),(NULL,'a'),
+(NULL,'7'),(NULL,'g'),(NULL,'a'),(NULL,'a'),(NULL,'v'),(NULL,'a'),
+(NULL,'8'),(NULL,'h'),(NULL,'a'),(NULL,'a'),(NULL,'w'),(NULL,'a'),
+(NULL,'9'),(NULL,'i'),(NULL,'a'),(NULL,'a'),(NULL,'x'),(NULL,'a'),
+(NULL,'0'),(NULL,'j'),(NULL,'a'),(NULL,'a'),(NULL,'y'),(NULL,'a'),
+(NULL,'1'),(NULL,'k'),(NULL,'a'),(NULL,'a'),(NULL,'z'),(NULL,'a'),
+(NULL,'2'),(NULL,'l'),(NULL,'a'),(NULL,'a'),(NULL,'/'),(NULL,'a'),
+(NULL,'3'),(NULL,'m'),(NULL,'a'),(NULL,'a'),(NULL,'*'),(NULL,'a'),
+(NULL,'4'),(NULL,'n'),(NULL,'a'),(NULL,'a'),(NULL,'+'),(NULL,'a'),
+(NULL,'5'),(NULL,'o'),(NULL,'a'),(NULL,'a'),(NULL,'?'),(NULL,'a');
+select count(*) from t1;
+ALTER TABLE t1 ADD COLUMN x INT UNSIGNED NOT NULL;
+ALTER TABLE t1 ADD KEY c (c);
+ALTER TABLE t1 DROP KEY c;
+ALTER TABLE t1 DROP COLUMN x;
+ALTER TABLE t1 RENAME t2;
+ALTER TABLE t2 CHANGE COLUMN c c VARCHAR(251) NOT NULL;
+select count(*) from t2;
+DROP TABLE t2;
diff --git a/mysql-test/t/range.test b/mysql-test/t/range.test
new file mode 100644
index 00000000000..5dfce3ddcc9
--- /dev/null
+++ b/mysql-test/t/range.test
@@ -0,0 +1,102 @@
+#
+# Problem med range optimizer
+#
+
+drop table if exists t1;
+CREATE TABLE t1 (
+ event_date date DEFAULT '0000-00-00' NOT NULL,
+ type int(11) DEFAULT '0' NOT NULL,
+ event_id int(11) DEFAULT '0' NOT NULL,
+ PRIMARY KEY (event_date,type,event_id)
+);
+
+INSERT INTO t1 VALUES ('1999-07-10',100100,24),('1999-07-11',100100,25),('1999-07-13',100600,0),('1999-07-13',100600,4),('1999-07-13',100600,26),('1999-07-14',100600,10),('1999-07-15',100600,16),('1999-07-15',100800,45),('1999-07-15',101000,47),('1999-07-16',100800,46),('1999-07-20',100600,5),('1999-07-20',100600,27),('1999-07-21',100600,11),('1999-07-22',100600,17),('1999-07-23',100100,39),('1999-07-24',100100,39),('1999-07-24',100500,40),('1999-07-25',100100,39),('1999-07-27',100600,1),('1999-07-27',100600,6),('1999-07-27',100600,28),('1999-07-28',100600,12),('1999-07-29',100500,41),('1999-07-29',100600,18),('1999-07-30',100500,41),('1999-07-31',100500,41),('1999-08-01',100700,34),('1999-08-03',100600,7),('1999-08-03',100600,29),('1999-08-04',100600,13),('1999-08-05',100500,42),('1999-08-05',100600,19),('1999-08-06',100500,42),('1999-08-07',100500,42),('1999-08-08',100500,42),('1999-08-10',100600,2),('1999-08-10',100600,9),('1999-08-10',100600,30),('1999-08-11',100600,14),('1999-08-12',100600,20),('1999-08-17',100500,8),('1999-08-17',100600,31),('1999-08-18',100600,15),('1999-08-19',100600,22),('1999-08-24',100600,3),('1999-08-24',100600,32),('1999-08-27',100500,43),('1999-08-31',100600,33),('1999-09-17',100100,37),('1999-09-18',100100,37),('1999-09-19',100100,37),('2000-12-18',100700,38);
+
+select event_date,type,event_id from t1 WHERE event_date >= "1999-07-01" AND event_date < "1999-07-15" AND (type=100600 OR type=100100) ORDER BY event_date;
+explain select event_date,type,event_id from t1 WHERE type = 100601 and event_date >= "1999-07-01" AND event_date < "1999-07-15" AND (type=100600 OR type=100100) ORDER BY event_date;
+select event_date,type,event_id from t1 WHERE event_date >= "1999-07-01" AND event_date <= "1999-07-15" AND (type=100600 OR type=100100) or event_date >= "1999-07-01" AND event_date <= "1999-07-15" AND type=100099;
+drop table t1;
+
+CREATE TABLE t1 (
+ PAPER_ID smallint(6) DEFAULT '0' NOT NULL,
+ YEAR smallint(6) DEFAULT '0' NOT NULL,
+ ISSUE smallint(6) DEFAULT '0' NOT NULL,
+ CLOSED tinyint(4) DEFAULT '0' NOT NULL,
+ ISS_DATE date DEFAULT '0000-00-00' NOT NULL,
+ PRIMARY KEY (PAPER_ID,YEAR,ISSUE)
+);
+INSERT INTO t1 VALUES (3,1999,34,0,'1999-07-12');
+INSERT INTO t1 VALUES (1,1999,111,0,'1999-03-23');
+INSERT INTO t1 VALUES (1,1999,222,0,'1999-03-23');
+INSERT INTO t1 VALUES (3,1999,33,0,'1999-07-12');
+INSERT INTO t1 VALUES (3,1999,32,0,'1999-07-12');
+INSERT INTO t1 VALUES (3,1999,31,0,'1999-07-12');
+INSERT INTO t1 VALUES (3,1999,30,0,'1999-07-12');
+INSERT INTO t1 VALUES (3,1999,29,0,'1999-07-12');
+INSERT INTO t1 VALUES (3,1999,28,0,'1999-07-12');
+INSERT INTO t1 VALUES (1,1999,40,1,'1999-05-01');
+INSERT INTO t1 VALUES (1,1999,41,1,'1999-05-01');
+INSERT INTO t1 VALUES (1,1999,42,1,'1999-05-01');
+INSERT INTO t1 VALUES (1,1999,46,1,'1999-05-01');
+INSERT INTO t1 VALUES (1,1999,47,1,'1999-05-01');
+INSERT INTO t1 VALUES (1,1999,48,1,'1999-05-01');
+INSERT INTO t1 VALUES (1,1999,49,1,'1999-05-01');
+INSERT INTO t1 VALUES (1,1999,50,0,'1999-05-01');
+INSERT INTO t1 VALUES (1,1999,51,0,'1999-05-01');
+INSERT INTO t1 VALUES (1,1999,200,0,'1999-06-28');
+INSERT INTO t1 VALUES (1,1999,52,0,'1999-06-28');
+INSERT INTO t1 VALUES (1,1999,53,0,'1999-06-28');
+INSERT INTO t1 VALUES (1,1999,54,0,'1999-06-28');
+INSERT INTO t1 VALUES (1,1999,55,0,'1999-06-28');
+INSERT INTO t1 VALUES (1,1999,56,0,'1999-07-01');
+INSERT INTO t1 VALUES (1,1999,57,0,'1999-07-01');
+INSERT INTO t1 VALUES (1,1999,58,0,'1999-07-01');
+INSERT INTO t1 VALUES (1,1999,59,0,'1999-07-01');
+INSERT INTO t1 VALUES (1,1999,60,0,'1999-07-01');
+INSERT INTO t1 VALUES (3,1999,35,0,'1999-07-12');
+select YEAR,ISSUE from t1 where PAPER_ID=3 and (YEAR>1999 or (YEAR=1999 and ISSUE>28)) order by YEAR,ISSUE;
+check table t1;
+repair table t1;
+drop table t1;
+
+CREATE TABLE t1 (
+ id int(11) NOT NULL auto_increment,
+ parent_id int(11) DEFAULT '0' NOT NULL,
+ level tinyint(4) DEFAULT '0' NOT NULL,
+ PRIMARY KEY (id),
+ KEY parent_id (parent_id),
+ KEY level (level)
+);
+INSERT INTO t1 VALUES (1,0,0),(3,1,1),(4,1,1),(8,2,2),(9,2,2),(17,3,2),(22,4,2),(24,4,2),(28,5,2),(29,5,2),(30,5,2),(31,6,2),(32,6,2),(33,6,2),(203,7,2),(202,7,2),(20,3,2),(157,0,0),(193,5,2),(40,7,2),(2,1,1),(15,2,2),(6,1,1),(34,6,2),(35,6,2),(16,3,2),(7,1,1),(36,7,2),(18,3,2),(26,5,2),(27,5,2),(183,4,2),(38,7,2),(25,5,2),(37,7,2),(21,4,2),(19,3,2),(5,1,1),(179,5,2);
+SELECT * FROM t1 WHERE level = 1 AND parent_id = 1;
+# The following select returned 0 rows in 3.23.8
+SELECT * FROM t1 WHERE level = 1 AND parent_id = 1 order by id;
+drop table t1;
+
+#
+# Testing of bug in range optimizer with many key parts and > and <
+#
+
+create table t1(
+ Satellite varchar(25) not null,
+ SensorMode varchar(25) not null,
+ FullImageCornersUpperLeftLongitude double not null,
+ FullImageCornersUpperRightLongitude double not null,
+ FullImageCornersUpperRightLatitude double not null,
+ FullImageCornersLowerRightLatitude double not null,
+ index two (Satellite, SensorMode, FullImageCornersUpperLeftLongitude, FullImageCornersUpperRightLongitude, FullImageCornersUpperRightLatitude, FullImageCornersLowerRightLatitude));
+
+insert into t1 values("OV-3","PAN1",91,-92,40,50);
+insert into t1 values("OV-4","PAN1",91,-92,40,50);
+
+select * from t1 where t1.Satellite = "OV-3" and t1.SensorMode = "PAN1" and t1.FullImageCornersUpperLeftLongitude > -90.000000 and t1.FullImageCornersUpperRightLongitude < -82.000000;
+drop table t1;
+
+create table t1 ( aString char(100) not null default "", key aString (aString(10)) );
+insert t1 (aString) values ( "believe in myself" ), ( "believe" ), ("baaa" ), ( "believe in love");
+select * from t1 where aString < "believe in myself" order by aString;
+select * from t1 where aString > "believe in love" order by aString;
+alter table t1 drop key aString;
+select * from t1 where aString < "believe in myself" order by aString;
+select * from t1 where aString > "believe in love" order by aString;
+drop table t1;
diff --git a/mysql-test/t/rename.test b/mysql-test/t/rename.test
new file mode 100644
index 00000000000..98b2e267677
--- /dev/null
+++ b/mysql-test/t/rename.test
@@ -0,0 +1,26 @@
+#
+# Test of rename table
+#
+
+drop table if exists t1,t2,t3,t4;
+create table t0 SELECT 1,"table 1";
+create table t2 SELECT 2,"table 2";
+create table t3 SELECT 3,"table 3";
+rename table t0 to t1;
+rename table t3 to t4, t2 to t3, t1 to t2, t4 to t1;
+select * from t1;
+rename table t3 to t4, t2 to t3, t1 to t2, t4 to t1;
+rename table t3 to t4, t2 to t3, t1 to t2, t4 to t1;
+select * from t1;
+# The following should give errors
+!$1050 rename table t1 to t2;
+!$1050 rename table t1 to t1;
+!$1050 rename table t3 to t4, t2 to t3, t1 to t2, t4 to t2;
+show tables like "t_";
+!$1050 rename table t3 to t1, t2 to t3, t1 to t2, t4 to t1;
+!$1017 rename table t3 to t4, t5 to t3, t1 to t2, t4 to t1;
+
+select * from t1;
+select * from t2;
+select * from t3;
+drop table if exists t1,t2,t3,t4;
diff --git a/mysql-test/t/replace.test b/mysql-test/t/replace.test
index 2d59b26a525..100941108c8 100644
--- a/mysql-test/t/replace.test
+++ b/mysql-test/t/replace.test
@@ -1,5 +1,7 @@
+-- source include/have_isam.inc
+
#
-# Test of REPLACE with ISAM and MyISAM and BDB
+# Test of REPLACE with ISAM and MyISAM and HEAP
#
drop table if exists t1;
@@ -15,8 +17,6 @@ replace into t1 (gesuchnr,benutzer_id) values (1,1);
replace into t1 (gesuchnr,benutzer_id) values (1,1);
alter table t1 type=myisam;
replace into t1 (gesuchnr,benutzer_id) values (1,1);
-alter table t1 type=bdb;
-replace into t1 (gesuchnr,benutzer_id) values (1,1);
alter table t1 type=heap;
replace into t1 (gesuchnr,benutzer_id) values (1,1);
drop table t1;
diff --git a/mysql-test/t/rollback.test b/mysql-test/t/rollback.test
new file mode 100644
index 00000000000..6ea2cca887f
--- /dev/null
+++ b/mysql-test/t/rollback.test
@@ -0,0 +1,14 @@
+#
+# This test should fail as MyISAM doesn't have rollback
+#
+
+drop table if exists t1;
+
+create table t1 (n int not null primary key) type=myisam;
+begin work;
+insert into t1 values (4);
+insert into t1 values (5);
+# Should give an error
+!$1196 rollback;
+select * from t1;
+drop table t1;
diff --git a/mysql-test/t/sel000004.test b/mysql-test/t/sel000004.test
deleted file mode 100644
index e6adc549163..00000000000
--- a/mysql-test/t/sel000004.test
+++ /dev/null
@@ -1,14 +0,0 @@
-# sel000004
-#
-# Versions
-# --------
-# 3.22
-# 3.23
-#
-# Description
-# -----------
-# Simple arithmetic.
-# Testing MOD(), SIGN(), and arithmetic grouping.
-#
-
-@r/sel000004.result SELECT 1+1,1-1,1+1*2,8/5,8%5,MOD(8,5),MOD(8,5)|0,-(1+1)*-2,SIGN(-5);
diff --git a/mysql-test/t/sel000005.test b/mysql-test/t/sel000005.test
deleted file mode 100644
index 3a7856b6256..00000000000
--- a/mysql-test/t/sel000005.test
+++ /dev/null
@@ -1,14 +0,0 @@
-# sel000005
-#
-# Versions
-# --------
-# 3.22
-# 3.23
-#
-# Description
-# -----------
-# Numeric functions.
-# Testing FLOOR(), CEILING(), ROUND().
-#
-
-@r/sel000005.result SELECT FLOOR(5.5),FLOOR(-5.5),CEILING(5.5),CEILING(-5.5),ROUND(5.5),ROUND(-5.5);
diff --git a/mysql-test/t/sel000006.test b/mysql-test/t/sel000006.test
deleted file mode 100644
index 4f3d20f0c6d..00000000000
--- a/mysql-test/t/sel000006.test
+++ /dev/null
@@ -1,14 +0,0 @@
-# sel000006
-#
-# Versions
-# --------
-# 3.22
-# 3.23
-#
-# Description
-# -----------
-# Numeric functions.
-# Testing ROUND(); hundreths precision.
-#
-
-@r/sel000006.result SELECT ROUND(5.64,1),ROUND(5.64,2),ROUND(5.64,-1),ROUND(5.64,-2);
diff --git a/mysql-test/t/sel000007.test b/mysql-test/t/sel000007.test
deleted file mode 100644
index 494ba902f90..00000000000
--- a/mysql-test/t/sel000007.test
+++ /dev/null
@@ -1,14 +0,0 @@
-# sel000007
-#
-# Versions
-# --------
-# 3.22
-# 3.23
-#
-# Description
-# -----------
-# Numeric functions.
-# Testing TRUNCATE().
-#
-
-@r/sel000007.result SELECT TRUNCATE(52.64,1),TRUNCATE(52.64,2),TRUNCATE(52.64,-1),TRUNCATE(52.64,-2);
diff --git a/mysql-test/t/sel000008.test b/mysql-test/t/sel000008.test
deleted file mode 100644
index b7d46fed8a1..00000000000
--- a/mysql-test/t/sel000008.test
+++ /dev/null
@@ -1,14 +0,0 @@
-# sel000008
-#
-# Versions
-# --------
-# 3.22
-# 3.23
-#
-# Description
-# -----------
-# Numeric functions.
-# Testing ABS(), LOG(), LOG10(), EXP(), SQRT(), POW(), RAND(), POWER().
-#
-
-@r/sel000008.result SELECT ABS(-10),LOG(EXP(10)),EXP(LOG(SQRT(10))*2),POW(10,LOG10(10)),RAND(999999),RAND(),POWER(2,4);
diff --git a/mysql-test/t/sel000009.test b/mysql-test/t/sel000009.test
deleted file mode 100644
index 347f671fadc..00000000000
--- a/mysql-test/t/sel000009.test
+++ /dev/null
@@ -1,14 +0,0 @@
-# sel000009
-#
-# Versions
-# --------
-# 3.22
-# 3.23
-#
-# Description
-# -----------
-# Numeric functions.
-# Testing PI(), SIN(), COS(), TAN(), COT(), ASIN(), ACOS(), ATAN().
-#
-
-@r/sel000009.result SELECT PI(),SIN(PI()/2),COS(PI()/2),TAN(PI()),COT(1),ASIN(1),ACOS(0),ATAN(1);
diff --git a/mysql-test/t/sel000010.test b/mysql-test/t/sel000010.test
deleted file mode 100644
index ae142c92c32..00000000000
--- a/mysql-test/t/sel000010.test
+++ /dev/null
@@ -1,14 +0,0 @@
-# sel000010
-#
-# Versions
-# --------
-# 3.22
-# 3.23
-#
-# Description
-# -----------
-# Numeric bitwise comparisons.
-# Testing |, &, BIT_COUNT().
-#
-
-@r/sel000010.result SELECT 1 | (1+1),5 & 3,BIT_COUNT(7);
diff --git a/mysql-test/t/sel000011.test b/mysql-test/t/sel000011.test
deleted file mode 100644
index 73d022c74e9..00000000000
--- a/mysql-test/t/sel000011.test
+++ /dev/null
@@ -1,14 +0,0 @@
-# sel000011
-#
-# Versions
-# --------
-# 3.22
-# 3.23
-#
-# Description
-# -----------
-# Numeric bitmoving comparisons.
-# Testing <<, >>.
-#
-
-@r/sel000011.result SELECT 1 << 32,1 << 63, 1 << 64, 4 >> 2, 4 >> 63, 1<< 63 >> 60;
diff --git a/mysql-test/t/sel000012.test b/mysql-test/t/sel000012.test
deleted file mode 100644
index e7f497dcd51..00000000000
--- a/mysql-test/t/sel000012.test
+++ /dev/null
@@ -1,13 +0,0 @@
-# sel000012
-#
-# Versions
-# --------
-# 3.22
-# 3.23
-#
-# Description
-# -----------
-# Numeric floating point.
-#
-
-@r/sel000012.result SELECT 10,10.0,10.,.1e+2,100.0e-1;
diff --git a/mysql-test/t/sel000013.test b/mysql-test/t/sel000013.test
deleted file mode 100644
index 7d22c3645e3..00000000000
--- a/mysql-test/t/sel000013.test
+++ /dev/null
@@ -1,13 +0,0 @@
-# sel000013
-#
-# Versions
-# --------
-# 3.22
-# 3.23
-#
-# Description
-# -----------
-# Numeric floating point.
-#
-
-@r/sel000013.result SELECT 6e-05, -6e-05, --6e-05, -6e-05+1.000000;
diff --git a/mysql-test/t/sel000014.test b/mysql-test/t/sel000014.test
deleted file mode 100644
index b29aaf0e28f..00000000000
--- a/mysql-test/t/sel000014.test
+++ /dev/null
@@ -1,14 +0,0 @@
-# sel000014
-#
-# Versions
-# --------
-# 3.22
-# 3.23
-#
-# Description
-# -----------
-# Numerics.
-# Testing pos/neg and zero padding.
-#
-
-@r/sel000014.result SELECT 0,256,00000000000000065536,2147483647,-2147483648,2147483648,+4294967296;
diff --git a/mysql-test/t/sel000015.test b/mysql-test/t/sel000015.test
deleted file mode 100644
index 44d6dc3afec..00000000000
--- a/mysql-test/t/sel000015.test
+++ /dev/null
@@ -1,14 +0,0 @@
-# sel000015
-#
-# Versions
-# --------
-# 3.22
-# 3.23
-#
-# Description
-# -----------
-# Numerics.
-# Testing big numbers.
-#
-
-@r/sel000015.result SELECT 922337203685477580,92233720368547758000;
diff --git a/mysql-test/t/sel000016.test b/mysql-test/t/sel000016.test
deleted file mode 100644
index 10f9cad9bc9..00000000000
--- a/mysql-test/t/sel000016.test
+++ /dev/null
@@ -1,14 +0,0 @@
-# sel000016
-#
-# Versions
-# --------
-# 3.22
-# 3.23
-#
-# Description
-# -----------
-# Numerics.
-# Testing big negative numbers.
-#
-
-@r/sel000016.result SELECT -922337203685477580,-92233720368547758000;
diff --git a/mysql-test/t/sel000017.test b/mysql-test/t/sel000017.test
deleted file mode 100644
index 01395e1b6c5..00000000000
--- a/mysql-test/t/sel000017.test
+++ /dev/null
@@ -1,14 +0,0 @@
-# sel000017
-#
-# Versions
-# --------
-# 3.22
-# 3.23
-#
-# Description
-# -----------
-# Numerics.
-# Testing big pos/neg numbers.
-#
-
-@r/sel000017.result SELECT 9223372036854775807,-009223372036854775808;
diff --git a/mysql-test/t/sel000018.test b/mysql-test/t/sel000018.test
deleted file mode 100644
index 48525ac52c5..00000000000
--- a/mysql-test/t/sel000018.test
+++ /dev/null
@@ -1,14 +0,0 @@
-# sel000018
-#
-# Versions
-# --------
-# 3.22
-# 3.23
-#
-# Description
-# -----------
-# Numerics.
-# Testing big pos/neg numbers.
-#
-
-@r/sel000018.result SELECT +9999999999999999999,-9999999999999999999;
diff --git a/mysql-test/t/sel000019.test b/mysql-test/t/sel000019.test
deleted file mode 100644
index 0c7857a11f5..00000000000
--- a/mysql-test/t/sel000019.test
+++ /dev/null
@@ -1,14 +0,0 @@
-# sel000019
-#
-# Versions
-# --------
-# 3.22
-# 3.23
-#
-# Description
-# -----------
-# Numerics.
-# Testing DEGREES(), RADIANS().
-#
-
-@r/sel000019.result SELECT DEGREES(PI()),RADIANS(360);
diff --git a/mysql-test/t/sel000020.test b/mysql-test/t/sel000020.test
deleted file mode 100644
index f3835ac3c2b..00000000000
--- a/mysql-test/t/sel000020.test
+++ /dev/null
@@ -1,14 +0,0 @@
-# sel000020
-#
-# Versions
-# --------
-# 3.22
-# 3.23
-#
-# Description
-# -----------
-# Strings.
-# Testing string comparisons; STRCMP(), =, >, >=, <=, !=.
-#
-
-@r/sel000020.result SELECT 0=0,1>0,1>=1,1<0,1<=0,1!=0,STRCMP("abc","abcd"),STRCMP("b","a"),STRCMP("a","a");
diff --git a/mysql-test/t/sel000021.test b/mysql-test/t/sel000021.test
deleted file mode 100644
index d4d87845415..00000000000
--- a/mysql-test/t/sel000021.test
+++ /dev/null
@@ -1,14 +0,0 @@
-# sel000021
-#
-# Versions
-# --------
-# 3.22
-# 3.23
-#
-# Description
-# -----------
-# Strings.
-# Testing string comparisons; =, >, >=, <=, <>.
-#
-
-@r/sel000021.result SELECT "a"<"b","a"<="b","b">="a","b">"a","a"="A","a"<>"b";
diff --git a/mysql-test/t/sel000022.test b/mysql-test/t/sel000022.test
deleted file mode 100644
index 68a713d4baa..00000000000
--- a/mysql-test/t/sel000022.test
+++ /dev/null
@@ -1,14 +0,0 @@
-# sel000022
-#
-# Versions
-# --------
-# 3.22
-# 3.23
-#
-# Description
-# -----------
-# Strings.
-# Testing string comparisons; =, >, <=.
-#
-
-@r/sel000022.result SELECT "a "="A", "A "="a", "a " <= "A b";
diff --git a/mysql-test/t/sel000023.test b/mysql-test/t/sel000023.test
deleted file mode 100644
index d4b62603c4a..00000000000
--- a/mysql-test/t/sel000023.test
+++ /dev/null
@@ -1,14 +0,0 @@
-# sel000023
-#
-# Versions
-# --------
-# 3.22
-# 3.23
-#
-# Description
-# -----------
-# Strings.
-# Testing string comparisons; LIKE, NOT LIKE, '%'.
-#
-
-@r/sel000023.result SELECT "abc" LIKE "a%", "abc" NOT LIKE "%d%", "a%" LIKE "a\%","abc%" LIKE "a%\%","abcd" LIKE "a%b_%d", "a" LIKE "%%a","abcde" LIKE "a%_e","abc" LIKE "abc%";
diff --git a/mysql-test/t/sel000024.test b/mysql-test/t/sel000024.test
deleted file mode 100644
index bc60fcf0074..00000000000
--- a/mysql-test/t/sel000024.test
+++ /dev/null
@@ -1,14 +0,0 @@
-# sel000024
-#
-# Versions
-# --------
-# 3.22
-# 3.23
-#
-# Description
-# -----------
-# Strings.
-# Testing string comparisons; LIKE, '%'.
-#
-
-@r/sel000024.result SELECT "a" LIKE "%%b","a" LIKE "%%ab","ab" LIKE "a\%", "ab" LIKE "_", "ab" LIKE "ab_", "abc" LIKE "%_d", "abc" LIKE "abc%d";
diff --git a/mysql-test/t/sel000025.test b/mysql-test/t/sel000025.test
deleted file mode 100644
index 4a8e380f1b8..00000000000
--- a/mysql-test/t/sel000025.test
+++ /dev/null
@@ -1,14 +0,0 @@
-# sel000025
-#
-# Versions
-# --------
-# 3.22
-# 3.23
-#
-# Description
-# -----------
-# Strings.
-# Testing string comparisons; LIKE, ESCAPE, '%'.
-#
-
-@r/sel000025.result SELECT '?' LIKE '|%', '?' LIKE '|%' ESCAPE '|', '%' LIKE '|%', '%' LIKE '|%' ESCAPE '|', '%' LIKE '%';
diff --git a/mysql-test/t/sel000026.test b/mysql-test/t/sel000026.test
deleted file mode 100644
index dde3a18bfb5..00000000000
--- a/mysql-test/t/sel000026.test
+++ /dev/null
@@ -1,14 +0,0 @@
-# sel000026
-#
-# Versions
-# --------
-# 3.22
-# 3.23
-#
-# Description
-# -----------
-# Strings.
-# Testing string comparisons; LIKE, '%'.
-#
-
-@r/sel000026.result SELECT 'abc' LIKE '%c','abcabc' LIKE '%c', "ab" LIKE "", "ab" LIKE "a", "ab" LIKE "ab";
diff --git a/mysql-test/t/sel000027.test b/mysql-test/t/sel000027.test
deleted file mode 100644
index b0dc139f3ff..00000000000
--- a/mysql-test/t/sel000027.test
+++ /dev/null
@@ -1,14 +0,0 @@
-# sel000027
-#
-# Versions
-# --------
-# 3.22
-# 3.23
-#
-# Description
-# -----------
-# Strings.
-# Testing string comparisons; REGEXP.
-#
-
-@r/sel000027.result SELECT "Det här är svenska" REGEXP "h[[:alpha:]]+r", "aba" REGEXP "^(a|b)*$";
diff --git a/mysql-test/t/sel000028.test b/mysql-test/t/sel000028.test
deleted file mode 100644
index 58aa1b28953..00000000000
--- a/mysql-test/t/sel000028.test
+++ /dev/null
@@ -1,14 +0,0 @@
-# sel000028
-#
-# Versions
-# --------
-# 3.22
-# 3.23
-#
-# Description
-# -----------
-# Strings.
-# Testing string comparisons; REGEXP, CONCAT().
-#
-
-@r/sel000028.result SELECT "aba" REGEXP CONCAT("^","a");
diff --git a/mysql-test/t/sel000029.test b/mysql-test/t/sel000029.test
deleted file mode 100644
index 015b15de1a3..00000000000
--- a/mysql-test/t/sel000029.test
+++ /dev/null
@@ -1,14 +0,0 @@
-# sel000029
-#
-# Versions
-# --------
-# 3.22
-# 3.23
-#
-# Description
-# -----------
-# Strings.
-# Testing string comparisons; NOT, AND, OR, !, &&, ||.
-#
-
-@r/sel000029.result SELECT !0,NOT 0=1,!(0=0),1 AND 1,1 && 0,0 OR 1,1 || NULL, 1=1 OR 1=1 AND 1=0;
diff --git a/mysql-test/t/sel000030.test b/mysql-test/t/sel000030.test
deleted file mode 100644
index 57e5454023c..00000000000
--- a/mysql-test/t/sel000030.test
+++ /dev/null
@@ -1,14 +0,0 @@
-# sel000030
-#
-# Versions
-# --------
-# 3.22
-# 3.23
-#
-# Description
-# -----------
-# Control flow.
-# Testing control flow; IF()
-#
-
-@r/sel000030.result SELECT IF(0,"ERROR","this"),IF(1,"is","ERROR"),IF(NULL,"ERROR","a"),IF(1,2,3)|0,IF(1,2.0,3.0)+0;
diff --git a/mysql-test/t/select_safe.test b/mysql-test/t/select_safe.test
new file mode 100644
index 00000000000..e76b7558997
--- /dev/null
+++ b/mysql-test/t/select_safe.test
@@ -0,0 +1,32 @@
+#
+# test of safe selects
+#
+
+drop table if exists t1;
+SET SQL_SAFE_UPDATES=1,SQL_SELECT_LIMIT=4, SQL_MAX_JOIN_SIZE=9;
+create table t1 (a int primary key, b char(20));
+insert into t1 values(1,"test");
+SELECT SQL_BUFFER_RESULT * from t1;
+update t1 set b="a" where a=1;
+delete from t1 where a=1;
+insert into t1 values(1,"test"),(2,"test2");
+SELECT SQL_BUFFER_RESULT * from t1;
+update t1 set b="a" where a=1;
+select 1 from t1,t1 as t2,t1 as t3,t1 as t4;
+
+# The following should give errors:
+!$1175 update t1 set b="a";
+!$1175 update t1 set b="a" where b="test";
+!$1175 delete from t1;
+!$1175 delete from t1 where b="test";
+!$1175 delete from t1 where a+0=1;
+!$1104 select 1 from t1,t1 as t2,t1 as t3,t1 as t4,t1 as t5;
+
+# The following should be ok:
+update t1 set b="a" limit 1;
+update t1 set b="a" where b="b" limit 2;
+delete from t1 where b="test" limit 1;
+delete from t1 where a+0=1 limit 2;
+drop table t1;
+
+SET SQL_SAFE_UPDATES=0,SQL_SELECT_LIMIT=DEFAULT, SQL_MAX_JOIN_SIZE=DEFAULT;
diff --git a/mysql-test/t/show_check.test b/mysql-test/t/show_check.test
new file mode 100644
index 00000000000..6c4e51d6030
--- /dev/null
+++ b/mysql-test/t/show_check.test
@@ -0,0 +1,28 @@
+#
+# Test of some show commands
+#
+create table t1 (a int not null primary key, b int not null,c int not null, key(b,c));
+insert into t1 values (1,2,2),(2,2,3),(3,2,4),(4,2,4);
+create table t2 type=isam select * from t1;
+optimize table t1;
+check table t1,t2;
+repair table t1,t2;
+check table t2,t1;
+lock tables t1 read;
+check table t2,t1;
+show keys from t1;
+drop table t1,t2;
+
+create table t1 (a int not null primary key, b int not null,c int not null, key(b,c));
+insert into t1 values (1,2,2),(2,2,3),(3,2,4),(4,2,4);
+check table t1 type=fast;
+check table t1 type=fast;
+check table t1 type=changed;
+insert into t1 values (5,5,5);
+check table t1 type=changed;
+check table t1 type=extended;
+show keys from t1;
+!$1062 insert into t1 values (5,5,5);
+optimize table t1;
+optimize table t1;
+drop table t1;
diff --git a/mysql-test/t/tablelock.test b/mysql-test/t/tablelock.test
new file mode 100644
index 00000000000..c32a3f7cd35
--- /dev/null
+++ b/mysql-test/t/tablelock.test
@@ -0,0 +1,47 @@
+#
+# Test of lock tables
+#
+
+create table t1 ( n int auto_increment primary key);
+lock tables t1 write;
+insert into t1 values(NULL);
+unlock tables;
+check table t1;
+lock tables t1 write, t1 as t0 read;
+insert into t1 values(NULL);
+unlock tables;
+check table t1;
+lock tables t1 write, t1 as t0 read, t1 as t2 read;
+insert into t1 values(NULL);
+unlock tables;
+check table t1;
+lock tables t1 write, t1 as t0 write, t1 as t2 read;
+insert into t1 values(NULL);
+unlock tables;
+check table t1;
+lock tables t1 write, t1 as t0 write, t1 as t2 read, t1 as t3 read;
+insert into t1 values(NULL);
+unlock tables;
+check table t1;
+lock tables t1 write, t1 as t0 write, t1 as t2 write;
+insert into t1 values(NULL);
+unlock tables;
+check table t1;
+drop table t1;
+
+#
+# Test of locking and delete of files
+#
+
+CREATE TABLE t1 (a int);
+CREATE TABLE t2 (a int);
+lock tables t1 write,t1 as b write, t2 write, t2 as c read;
+drop table t1;
+drop table t2;
+
+CREATE TABLE t1 (a int);
+CREATE TABLE t2 (a int);
+lock tables t1 write,t1 as b write, t2 write, t2 as c read;
+drop table t2;
+drop table t1;
+unlock tables;
diff --git a/mysql-test/t/temp_table.test b/mysql-test/t/temp_table.test
new file mode 100644
index 00000000000..3cf18bae9fe
--- /dev/null
+++ b/mysql-test/t/temp_table.test
@@ -0,0 +1,62 @@
+#
+# Test of temporary tables
+#
+
+drop table if exists t1,t2;
+CREATE TABLE t1 (c int not null, d char (10) not null);
+insert into t1 values(1,""),(2,"a"),(3,"b");
+CREATE TEMPORARY TABLE t1 (a int not null, b char (10) not null);
+insert into t1 values(4,"e"),(5,"f"),(6,"g");
+alter table t1 rename t2;
+select * from t1;
+select * from t2;
+CREATE TABLE t2 (x int not null, y int not null);
+alter table t2 rename t1;
+select * from t1;
+create TEMPORARY TABLE t2 type=heap select * from t1;
+create TEMPORARY TABLE IF NOT EXISTS t2 (a int) type=heap;
+
+# This should give errors
+!$1050 CREATE TEMPORARY TABLE t1 (a int not null, b char (10) not null);
+!$1050 ALTER TABLE t1 RENAME t2;
+
+select * from t2;
+alter table t2 add primary key (a,b);
+drop table t1,t2;
+select * from t1;
+drop table t2;
+create temporary table t1 select *,2 as "e" from t1;
+select * from t1;
+drop table t1;
+drop table t1;
+
+#
+# Test CONCAT_WS with temporary tables
+#
+
+drop table if exists t1;
+CREATE TABLE t1 (pkCrash INTEGER PRIMARY KEY,strCrash VARCHAR(255));
+INSERT INTO t1 ( pkCrash, strCrash ) VALUES ( 1, '1');
+SELECT CONCAT_WS(pkCrash, strCrash) FROM t1;
+drop table t1;
+create temporary table t1 select 1 as 'x';
+drop table t1;
+CREATE TABLE t1 (x INT);
+INSERT INTO t1 VALUES (1), (2), (3);
+CREATE TEMPORARY TABLE tmp SELECT *, NULL FROM t1;
+drop table t1;
+
+#
+# Problem with ELT
+#
+create temporary table t1 (id int(10) not null unique);
+create temporary table t2 (id int(10) not null primary key,
+val int(10) not null);
+
+# put in some initial values
+insert into t1 values (1),(2),(4);
+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;
diff --git a/mysql-test/t/truncate.test b/mysql-test/t/truncate.test
new file mode 100644
index 00000000000..39c13b028cc
--- /dev/null
+++ b/mysql-test/t/truncate.test
@@ -0,0 +1,11 @@
+#
+# Test of truncate
+#
+create table t1 (a integer, b integer,c1 CHAR(10));
+truncate t1;
+select count(*) from t1;
+insert into t1 values(1,2,"test");
+select count(*) from t1;
+drop table t1;
+# The following should fail
+!$1146 select count(*) from t1;
diff --git a/mysql-test/t/type_blob.test b/mysql-test/t/type_blob.test
new file mode 100644
index 00000000000..82216fdd904
--- /dev/null
+++ b/mysql-test/t/type_blob.test
@@ -0,0 +1,279 @@
+#
+# test of full join with blob
+#
+
+drop table if exists t1,t2,t3,t4,t5,t6,t7;
+create table t1 (nr int(5) not null auto_increment,b blob,str char(10), primary key (nr));
+insert into t1 values (null,"a","A");
+insert into t1 values (null,"bbb","BBB");
+insert into t1 values (null,"ccc","CCC");
+select last_insert_id();
+select * from t1,t1 as t2;
+
+drop table t1;
+
+#
+# Test of changing TEXT column
+#
+
+create table t1 (a text);
+insert into t1 values ('where');
+update t1 set a='Where';
+select * from t1;
+drop table t1;
+
+#
+# test of blob, text, char and char binary
+#
+create table t1 (t text,c char(10),b blob, d char(10) binary);
+insert into t1 values (NULL,NULL,NULL,NULL);
+insert into t1 values ("","","","");
+insert into t1 values ("hello","hello","hello","hello");
+insert into t1 values ("HELLO","HELLO","HELLO","HELLO");
+insert into t1 values ("HELLO MY","HELLO MY","HELLO MY","HELLO MY");
+insert into t1 values ("a","a","a","a");
+insert into t1 values (1,1,1,1);
+insert into t1 values (NULL,NULL,NULL,NULL);
+update t1 set c="",b=null where c="1";
+
+lock tables t1 READ;
+show fields from t1;
+lock tables t1 WRITE;
+show fields from t1;
+unlock tables;
+
+select t from t1 where t like "hello";
+select c from t1 where c like "hello";
+select b from t1 where b like "hello";
+select d from t1 where d like "hello";
+select c from t1 having c like "hello";
+select d from t1 having d like "hello";
+select t from t1 where t like "%HELLO%";
+select c from t1 where c like "%HELLO%";
+select b from t1 where b like "%HELLO%";
+select d from t1 where d like "%HELLO%";
+select c from t1 having c like "%HELLO%";
+select d from t1 having d like "%HELLO%";
+select t from t1 order by t;
+select c from t1 order by c;
+select b from t1 order by b;
+select d from t1 order by d;
+select distinct t from t1;
+select distinct b from t1;
+select distinct t from t1 order by t;
+select distinct b from t1 order by b;
+select t from t1 group by t;
+select b from t1 group by b;
+set option sql_big_tables=1;
+select distinct t from t1;
+select distinct b from t1;
+select distinct t from t1 order by t;
+select distinct b from t1 order by b;
+select distinct c from t1;
+select distinct d from t1;
+select distinct c from t1 order by c;
+select distinct d from t1 order by d;
+select c from t1 group by c;
+select d from t1 group by d;
+set option sql_big_tables=0;
+select distinct * from t1;
+select t,count(*) from t1 group by t;
+select b,count(*) from t1 group by b;
+select c,count(*) from t1 group by c;
+select d,count(*) from t1 group by d;
+drop table t1;
+
+!$1089 create table t1 (a text, key (a(300))); # should give an error
+create table t1 (a text, key (a(255)));
+drop table t1;
+
+#
+# Test of join with blobs and min
+#
+
+CREATE TABLE t1 (
+ t1_id bigint(21) DEFAULT '0' NOT NULL auto_increment,
+ _field_72 varchar(128) DEFAULT '' NOT NULL,
+ _field_95 varchar(32),
+ _field_115 tinyint(4) DEFAULT '0' NOT NULL,
+ _field_122 tinyint(4) DEFAULT '0' NOT NULL,
+ _field_126 tinyint(4),
+ _field_134 tinyint(4),
+ PRIMARY KEY (t1_id),
+ UNIQUE _field_72 (_field_72),
+ KEY _field_115 (_field_115),
+ KEY _field_122 (_field_122)
+);
+
+
+INSERT INTO t1 VALUES (1,'admin','21232f297a57a5a743894a0e4a801fc3',0,1,NULL,NULL);
+INSERT INTO t1 VALUES (2,'hroberts','7415275a8c95952901e42b13a6b78566',0,1,NULL,NULL);
+INSERT INTO t1 VALUES (3,'guest','d41d8cd98f00b204e9800998ecf8427e',1,0,NULL,NULL);
+
+
+CREATE TABLE t2 (
+ seq_0_id bigint(21) DEFAULT '0' NOT NULL,
+ seq_1_id bigint(21) DEFAULT '0' NOT NULL,
+ PRIMARY KEY (seq_0_id,seq_1_id)
+);
+
+
+INSERT INTO t2 VALUES (1,1);
+INSERT INTO t2 VALUES (2,1);
+INSERT INTO t2 VALUES (2,2);
+
+CREATE TABLE t3 (
+ t3_id bigint(21) DEFAULT '0' NOT NULL auto_increment,
+ _field_131 varchar(128),
+ _field_133 tinyint(4) DEFAULT '0' NOT NULL,
+ _field_135 datetime DEFAULT '0000-00-00 00:00:00' NOT NULL,
+ _field_137 tinyint(4),
+ _field_139 datetime DEFAULT '0000-00-00 00:00:00' NOT NULL,
+ _field_140 blob,
+ _field_142 tinyint(4) DEFAULT '0' NOT NULL,
+ _field_145 tinyint(4) DEFAULT '0' NOT NULL,
+ _field_148 tinyint(4) DEFAULT '0' NOT NULL,
+ PRIMARY KEY (t3_id),
+ KEY _field_133 (_field_133),
+ KEY _field_135 (_field_135),
+ KEY _field_139 (_field_139),
+ KEY _field_142 (_field_142),
+ KEY _field_145 (_field_145),
+ KEY _field_148 (_field_148)
+);
+
+
+INSERT INTO t3 VALUES (1,'test job 1',0,'0000-00-00 00:00:00',0,'1999-02-25 22:43:32','test\r\njob\r\n1',0,0,0);
+INSERT INTO t3 VALUES (2,'test job 2',0,'0000-00-00 00:00:00',0,'1999-02-26 21:08:04','',0,0,0);
+
+
+CREATE TABLE t4 (
+ seq_0_id bigint(21) DEFAULT '0' NOT NULL,
+ seq_1_id bigint(21) DEFAULT '0' NOT NULL,
+ PRIMARY KEY (seq_0_id,seq_1_id)
+);
+
+
+INSERT INTO t4 VALUES (1,1);
+INSERT INTO t4 VALUES (2,1);
+
+CREATE TABLE t5 (
+ t5_id bigint(21) DEFAULT '0' NOT NULL auto_increment,
+ _field_149 tinyint(4),
+ _field_156 varchar(128) DEFAULT '' NOT NULL,
+ _field_157 varchar(128) DEFAULT '' NOT NULL,
+ _field_158 varchar(128) DEFAULT '' NOT NULL,
+ _field_159 varchar(128) DEFAULT '' NOT NULL,
+ _field_160 varchar(128) DEFAULT '' NOT NULL,
+ _field_161 varchar(128) DEFAULT '' NOT NULL,
+ PRIMARY KEY (t5_id),
+ KEY _field_156 (_field_156),
+ KEY _field_157 (_field_157),
+ KEY _field_158 (_field_158),
+ KEY _field_159 (_field_159),
+ KEY _field_160 (_field_160),
+ KEY _field_161 (_field_161)
+);
+
+
+INSERT INTO t5 VALUES (1,0,'tomato','','','','','');
+INSERT INTO t5 VALUES (2,0,'cilantro','','','','','');
+
+CREATE TABLE t6 (
+ seq_0_id bigint(21) DEFAULT '0' NOT NULL,
+ seq_1_id bigint(21) DEFAULT '0' NOT NULL,
+ PRIMARY KEY (seq_0_id,seq_1_id)
+);
+
+INSERT INTO t6 VALUES (1,1);
+INSERT INTO t6 VALUES (1,2);
+INSERT INTO t6 VALUES (2,2);
+
+CREATE TABLE t7 (
+ t7_id bigint(21) DEFAULT '0' NOT NULL auto_increment,
+ _field_143 tinyint(4),
+ _field_165 varchar(32),
+ _field_166 smallint(6) DEFAULT '0' NOT NULL,
+ PRIMARY KEY (t7_id),
+ KEY _field_166 (_field_166)
+);
+
+
+INSERT INTO t7 VALUES (1,0,'High',1);
+INSERT INTO t7 VALUES (2,0,'Medium',2);
+INSERT INTO t7 VALUES (3,0,'Low',3);
+
+select t3._field_140,min(t3._field_131), min(t3._field_135), min(t3._field_139), min(t3._field_137), min(link_alias_142._field_165), min(link_alias_133._field_72), min(t3._field_145), min(link_alias_148._field_156), replace(min(t3._field_140), "\r","^M"),t3.t3_id from t3 left join t4 on t4.seq_0_id = t3.t3_id left join t7 link_alias_142 on t4.seq_1_id = link_alias_142.t7_id left join t6 on t6.seq_0_id = t3.t3_id left join t1 link_alias_133 on t6.seq_1_id = link_alias_133.t1_id left join t2 on t2.seq_0_id = t3.t3_id left join t5 link_alias_148 on t2.seq_1_id = link_alias_148.t5_id where t3.t3_id in (1) group by t3.t3_id order by link_alias_142._field_166, _field_139, link_alias_133._field_72, _field_135, link_alias_148._field_156;
+
+drop table t1,t2,t3,t4,t5,t6,t7;
+
+#
+# Test of timestamp and blobs
+#
+
+CREATE TABLE t1 (value TEXT NOT NULL, id VARCHAR(32) NOT NULL, stamp timestamp, PRIMARY KEY (id));
+INSERT INTO t1 VALUES ("my value", "myKey","1999-04-02 00:00:00");
+SELECT stamp FROM t1 WHERE id="myKey";
+UPDATE t1 SET value="my value" WHERE id="myKey";
+SELECT stamp FROM t1 WHERE id="myKey";
+drop table t1;
+
+create table t1 (a timestamp);
+insert into t1 values (now());
+select date_format(a,"%Y %y"),year(a),year(now()) from t1;
+drop table t1;
+
+create table t1 (ix timestamp);
+insert into t1 values (19991101000000),(19990102030405),(19990630232922),(19990601000000),(19990930232922),(19990531232922),(19990501000000),(19991101000000),(19990501000000);
+select * from t1;
+drop table t1;
+
+CREATE TABLE t1 (date date, date_time datetime, time_stamp timestamp);
+INSERT INTO t1 VALUES ("1998-12-31","1998-12-31 23:59:59",19981231235959);
+INSERT INTO t1 VALUES ("1999-01-01","1999-01-01 00:00:00",19990101000000);
+INSERT INTO t1 VALUES ("1999-09-09","1999-09-09 23:59:59",19990909235959);
+INSERT INTO t1 VALUES ("2000-01-01","2000-01-01 00:00:00",20000101000000);
+INSERT INTO t1 VALUES ("2000-02-28","2000-02-28 00:00:00",20000228000000);
+INSERT INTO t1 VALUES ("2000-02-29","2000-02-29 00:00:00",20000229000000);
+INSERT INTO t1 VALUES ("2000-03-01","2000-03-01 00:00:00",20000301000000);
+INSERT INTO t1 VALUES ("2000-12-31","2000-12-31 23:59:59",20001231235959);
+INSERT INTO t1 VALUES ("2001-01-01","2001-01-01 00:00:00",20010101000000);
+INSERT INTO t1 VALUES ("2004-12-31","2004-12-31 23:59:59",20041231235959);
+INSERT INTO t1 VALUES ("2005-01-01","2005-01-01 00:00:00",20050101000000);
+INSERT INTO t1 VALUES ("2030-01-01","2030-01-01 00:00:00",20300101000000);
+INSERT INTO t1 VALUES ("2050-01-01","2050-01-01 00:00:00",20500101000000);
+SELECT * FROM t1;
+drop table t1;
+
+#
+# Test of reverse with empty blob
+#
+
+create table t1 (a blob);
+insert into t1 values ("empty"),("");
+select a,reverse(a) from t1;
+drop table t1;
+
+#
+# Test of BLOB:s with NULL keys.
+#
+
+create table t1 (a blob, key (a(10)));
+insert into t1 values ("bye"),("hello"),("hello"),("hello word");
+select * from t1 where a like "hello%";
+drop table t1;
+
+#
+# Test of found bug in group on text key
+#
+
+CREATE TABLE t1 (
+ f1 int(11) DEFAULT '0' NOT NULL,
+ f2 varchar(16) DEFAULT '' NOT NULL,
+ f5 text,
+ KEY index_name (f1,f2,f5(16))
+ );
+INSERT INTO t1 VALUES (0,'traktor','1111111111111');
+INSERT INTO t1 VALUES (1,'traktor','1111111111111111111111111');
+select count(*) from t1 where f2='traktor';
+drop table t1;
diff --git a/mysql-test/t/type_date.test b/mysql-test/t/type_date.test
new file mode 100644
index 00000000000..0d2e18bcc94
--- /dev/null
+++ b/mysql-test/t/type_date.test
@@ -0,0 +1,64 @@
+#
+# test of problem with date fields
+#
+create table t1 (a char(16), b date, c datetime);
+insert into t1 SET a='test 2000-01-01', b='2000-01-01', c='2000-01-01';
+select * from t1 where c = '2000-01-01';
+select * from t1 where b = '2000-01-01';
+drop table t1;
+
+#
+# problem with date conversions
+#
+
+drop table if exists t1,t2;
+CREATE TABLE t1 (name char(6),cdate date);
+INSERT INTO t1 VALUES ('name1','1998-01-01');
+INSERT INTO t1 VALUES ('name2','1998-01-01');
+INSERT INTO t1 VALUES ('name1','1998-01-02');
+INSERT INTO t1 VALUES ('name2','1998-01-02');
+CREATE TABLE t2 (cdate date, note char(6));
+INSERT INTO t2 VALUES ('1998-01-01','note01');
+INSERT INTO t2 VALUES ('1998-01-02','note02');
+select name,t1.cdate,note from t1,t2 where t1.cdate=t2.cdate and t1.cdate='1998-01-01';
+drop table t1,t2;
+
+#
+# Date and BETWEEN
+#
+
+CREATE TABLE t1 ( datum DATE );
+INSERT INTO t1 VALUES ( "2000-1-1" );
+INSERT INTO t1 VALUES ( "2000-1-2" );
+INSERT INTO t1 VALUES ( "2000-1-3" );
+INSERT INTO t1 VALUES ( "2000-1-4" );
+INSERT INTO t1 VALUES ( "2000-1-5" );
+SELECT * FROM t1 WHERE datum BETWEEN "2000-1-2" AND "2000-1-4";
+DROP TABLE t1;
+
+#
+# test of max(date) and having
+#
+
+CREATE TABLE t1 (
+ user_id char(10),
+ summa int(11),
+ rdate date
+);
+INSERT INTO t1 VALUES ('aaa',100,'1998-01-01');
+INSERT INTO t1 VALUES ('aaa',200,'1998-01-03');
+INSERT INTO t1 VALUES ('bbb',50,'1998-01-02');
+INSERT INTO t1 VALUES ('bbb',200,'1998-01-04');
+select max(rdate) as s from t1 where rdate < '1998-01-03' having s> "1998-01-01";
+select max(rdate) as s from t1 having s="1998-01-04";
+select max(rdate+0) as s from t1 having s="19980104";
+drop table t1;
+
+#
+# Test of date and not null
+#
+
+create table t1 (date date);
+insert into t1 values ("2000-08-10"),("2000-08-11");
+select date_add(date,INTERVAL 1 DAY),date_add(date,INTERVAL 1 SECOND) from t1;
+drop table t1;
diff --git a/mysql-test/t/type_datetime.test b/mysql-test/t/type_datetime.test
new file mode 100644
index 00000000000..36f9629b53b
--- /dev/null
+++ b/mysql-test/t/type_datetime.test
@@ -0,0 +1,29 @@
+#
+# testing different DATETIME ranges
+#
+create table t1 (t datetime);
+insert into t1 values(101),(691231),(700101),(991231),(10000101),(99991231),(101000000),(691231000000),(700101000000),(991231235959),(10000101000000),(99991231235959);
+select * from t1;
+delete from t1 where t > 0;
+optimize table t1;
+insert into t1 values("000101"),("691231"),("700101"),("991231"),("00000101"),("00010101"),("99991231"),("00101000000"),("691231000000"),("700101000000"),("991231235959"),("10000101000000"),("99991231235959");
+select * from t1;
+drop table t1;
+
+#
+# Test insert of now() and curtime()
+#
+
+CREATE TABLE t1 (a timestamp, b date, c time, d datetime);
+insert into t1 (b,c,d) values(now(),curtime(),now());
+select date_format(a,"%Y-%m-%d")=b,right(a,6)=c+0,a=d+0 from t1;
+drop table t1;
+
+#
+# Test of datetime and not null
+#
+
+CREATE TABLE t1 (a datetime not null);
+insert into t1 values (0);
+select * from t1 where a is null;
+drop table t1;
diff --git a/mysql-test/t/type_enum.test b/mysql-test/t/type_enum.test
new file mode 100644
index 00000000000..0278f53c642
--- /dev/null
+++ b/mysql-test/t/type_enum.test
@@ -0,0 +1,11 @@
+#
+# Problem with many enums
+#
+
+CREATE TABLE t1 (
+ field enum('001001','001004','001010','001018','001019','001020','001021','001027','001028','001029','001030','001031','001100','002003','002004','002005','002007','002008','002009','002012','002013','002014','003002','003003','003004','003005','003006','003007','003008','003009','003010','003011','003012','003013','003014','003015','003016','003017','003018','003019','004002','004003','004005','004006','004007','004008','004010','004012','004014','004016','004017','004020','004021','004022','004023','004024','004025','004026','006002','006004','006006','006010','006011','006012','006013','006014','007001','007002','007003','007004','007005','007006','007007','007008','007009','007010','007011','007012','007013','007014','007015','007016','007017','007018','007019','007020','007021','007022','007023','007024','007025','007026','007027','007028','007029','007030','007031','007032','007033','007034','007035','007036','007037','007038','007039','007040','007043','007044','009001','009002','009004','009005','009006','009007','009008','009009','009010','009011','009012','009013','010002','010003','010004','010005','010006','010007','010008','010009','010010','010011','010012','010013','010015','010016','010017','010018','010019','010020','010021','010022','010023','010024','010025','010026','010027','010028','011001','011002','011003','011004','011006','011012','011013','011014','011015','011016','012017','012018','012019','012023','012027','012028','012029','012030','012031','012032','012033','012034','012035','012036','012037','012038','012039','014001','016002','016003','016004','016007','016010','016011','016016','016019','016020','016021','016022','016023','016024','016026','016027','016028','016029','016030','016031','016032','016033','016034','017002','018001','019002','019004','020001','020003','020004','020005','020006','020007','020008','020009','022001','022002','022003','023001','023002','023003','023004','023005','023006','023007','023008','023010','023011','023012','023017','023019','023020','023021','023025','023026','023027','023028','023029','023030','023031','023032','023033','023034','023035','025001','025003','025004','025005','025006','025007','025008','025009','025010','025011','025012','025013','025014','025015','025016','025017','025018','025019','025020','025021','025022','025023','025024','025025','025026','025027','025028','025029','025030','025031','025032','025033','025034','025035','025036','025037','025038','025039','025040','025041','025042','025043','025044','025045','025046','025047','025048','025049','025050','025051','025052','025053','025054','025055','025056','025057','025058','025059','025060','025061','025062','025063','027001','027002','027011','035008','035012','036001','037001','037003','037004','037005','037006','037007','037008','037009','038004','038005','038006','038007','038009','039001','039002','039003','039004','039005','039006','046001','046002','046003','046004','046005','046007','046008','046009','046010','046011','046012','046013','046014','047001','047002','048001','051001','051002','051003','051004','052001','052002','052005','053015','053016','053019','053020','053023','053024','053026','053028','053029','053033','053034','053036','053037','053038','053039','053041','053042','053043','053045','053046','053047','053048','053051','053052','053054','053055','053056','053057','053068','053069','053070','053073','053074','053075','053086','053094','053095','053096','053097','053098','053099','053100','053101','053102','053103','053104','053105','053107','053122','053123','053124','053125','053127','053128','054001','054002','054003','054004','054005','054006','054007','054009','054010','056001','056002','056003','056004','056005','056006','056009','056010','056011','056016','056017','056018','056019','056020','056021','056022','057001','057002','057003','057004','058002','058003','058004','058005','060001','060003','060004','060005','060006','060007','061002','061003','061004','061005','061006','069006','069007','069010','069011','069012','069013','069014','069015','069016','069017','069018','069020','069021','069022','069023','069024','071002','071003','071004','071005','071006','071008','071011','071013','071020','071021','071022','072001','073001','073002','073003','073004','074001','074002','074003','074004','074005','074006','074007','074008','074009','074010','074011','074012','075001','075007','076101','076102','076103','077001','077002','077003','077004','077006','077007','077008','077009','078005','079002','079003','079004','079005','079006','079007','081001','082006','082007','082011','082013','082014','082015','082016','082017','082021','082022','082023','082024','082025','082026','082027','082028','082029','082030','082031','082032','082033','082034','082035','082036','082037','082038','082039','082040','082041','082042','082043','082044','084001','084002','084003','084004','084005','084007','084008','084009','084011','084013','084014','084016','084017','084027','084031','084032','084033','084035','084036','084037','084038','084039','084040','084041','084042','084043','084044','084045','084046','084047','084048','084049','084050','084051','085001','085002','085003','085004','085005','085006','085007','085009','085011','085012','085013','085014','085015','085016','085017','085018','085019','085020','085021','085022','085023','085028','085029','085030','085031','085033','085034','085035','085036','085037','085038','085040','085041','085042','085043','085044','085045','085046','085047','085048','085063','085064','085065','085068','085070','085071','085073','085082','085083','085086','085088','085089','085090','085091','085092','085093','085094','085095','085096','085097','085098','085099','085100','085101','085102','085103','085104','085105','085106','085107','085108','085109','085110','085111','085112','085113','085115','085119','085120','085121','085122','085123','085124','085125','085126','085127','085128','085129','085130','085132','085133','085134','085135','085136','085137','086001','086002','086003','086004','086005','088001','088003','088005','088006','088007','088008','088009','089001','090001','090002','090003','090004','090005','090006','090007','090008','090009','090010','090013','090015','090016','090017','090018','090019','090022','090027','090028','091001','091002','091005','091008','091009','091010','091011','091012','091013','091014','091015','091016','091017','091018','093001','093003','093098','093100','093102','093104','093141','093142','093146','093151','093153','093167','093168','093176','094001','094002','094004','094005','095004','099001','099002','100001','101001','102002','102003','105001','105002','106001','113001','113002','113003','113004','113005','113006','113007','113008','113009','113010','113011','113012','113013','113014','113015','113016','113017','113018','113019','113020','113021','113022','113023','113024','113025','113026','113027','113028','114001','115001','115002','115003','115004','115005','115006','115007','115008','115009','115010','115011','115012','115013','115014','115015','115016','115017','115018','115020','115021','115022','115023','115025','115026','115027','115028','115029','115030','115031','115032','115033','115034','115035','115036','115039','115040','115041','115042','115043','115044','115045','115046','115047','115048','115049','115050','115051','115052','115053','115054','115055','115056','115057','115059','115060','115061','115062','115063','115064','115065','115066','115067','115068','115069','115070','115071','115072','115073','115075','115076','115081','115082','115085','115086','115087','115088','115095','115096','115097','115098','115099','115101','115102','115103','115104','115105','115106','115108','115109','115110','115111','115112','115113','115114','115115','115116','115117','115118','115119','115120','115121','115122','116001','116002','116003','116004','116005','116006','116007','116008','116009','116010','116011','116012','117001','117002','117003','123001','124010','124014','124015','124019','124024','124025','124026','124027','124028','124029','124030','124031','124032','124033','124035','124036','124037','124038','124039','124040','124041','124042','124043','124044','124045','124046','124047','124048','124049','124050','124051','124052','124053','124054','124055','124056','124057','124058','124059','124060','124061','124062','124063','124064','124065','126001','126002','126003','126004','126005','126006','126007','126008','126009','126010','126011','126012','130001','132001','132002','132003','133001','133008','133009','133010','133011','133012','133013','133014','133015','133016','133017','133018','133019','133020','133021','133022','133023','133024','133025','133027','133028','133029','133030','133031','134001','135001','135002','135003','135004','135005','135006','135007','135008','135009','135010','136001','137009','137010','137011','137012','137013','137014','137015','137016','137017','137018','137019','138001','138002','138003','138004','139001','139003','140001','141001','141002','141003','141006','141007','141008','141009','141011','141012','141014','141015','141016','141017','141018','141019','141020','141021','141022','141023','141024','141025','141026','141027','141028','142001','142002','142003','142004','142005','142006','142007','142008','142010','142011','142012','144001','145001','145002','145003','145004','145005','145006','145007','145008','145009','145010','145011','145012','145013','145014','145015','145016','147001','150003','150005','150009','150013','150014','150015','150016','150017','150020','150021','152001','152002','152003','152004','152005','152006','152007','154001','154002','154003','155001','155002','155003','155004','155005','155006','159001','159002','159003','159004','160001','160002','160003','161001','162001','162002','162003','162004','162007','162010','162011','162012','163001','163002','163003','163005','163010','163011','163014','163015','163016','165001','165002','165003','165004','165005','165006','165007','165008','165009','165010','165011','165012','165013','165014','165015','165016','165017','165018','165019','165020','165021','165022','165023','165024','165025','165026','165027','165028','165029','165030','165031','165032','165033','165034','165035','165036','167001','168001','168002','168003','168004','168005','168007','168008','168009','168010','168011','168012','168013','168014','169001','169002','169003','169007','169008','169009','169010','170001','171001','171002','171003','171004','171005','171006','171007','171008','171009','172001','174001','174002','174003','176001','176002','176003','177001','177002','179001','179002','179003','179004','179005','179006','179007','179008','179009','179010','179011','179012','179013','179014','179015','179016','179017','179018','179019','179020','179021','179022','179023','179024','179025','179026','179027','179028','179029','179030','179031','179032','179033','179034','179035','179036','179037','179038','179039','179040','179041','179042','179043','179044','179045','179046','179047','180001','180010','180012','180013','180014','180015','180016','180017','180018','180019','180020','180021','180022','180023','180024','180025','180026','180027','180028','180030','180031','180032','180033','180034','180035','180036','180037','180038','180039','180041','180042','180043','180044','180045','180046','180047','180048','180049','180050','180051','180052','180053','180054','180055','180056','180057','180058','180059','180060','180061','180062','180063','180064','180065','180066','180067','180068','180069','180070','180071','182001','184001','184002','184005','184006','184007','184008','184009','184010','184011','185001','185003','187001','188001','188002','188003','188004','188005','188006','188007','188008','188009','188010','188011','191001','191002','192002','194001','194002','194003','194004','194005','194006','194007','195001','195002','195003','195004','195005','195006','195007','196001','196002','197001','197002','197003','197004','197005','197006','198001','198003','198004','198005','198006','198007','198008','198009','198010','198011','198012','198013','198014','198015','198016','198017','201001','201002','201005','202001','203001','203002','203003','203017','203018','203019','204001','204002','204003','205001','208001','208002','208003','208004','208005','209001','209002','209003','210001','210002','210003','210004','210005','210006','210007','210008','210009','210010','210011','210012','210013','211017','212001','212002','212003','212004','212005','212006','212007','212008','212009','212010','212011','212012','212013','218001','218003','218004','218006','218007','218008','218009','218011','218015','218016','218017','218018','218019','218020','218021','218022','218023','218024','218025','218026','218027','218028','218029','218030','218031','218032','218033','218034','218035','218036','221001','221002','221003','221004','221005','221006','221007','221008','221009','221010','221011','221012','221013','223001','223002','223003','224001','224002','224003','224006','224007','224008','225001','225002','225003','225004','225005','225006','225007','225008','225009','225010','225011','225012','225013','226001','226002','226003','226004','226005','226006','226007','226008','226009','227001','227002','227003','227004','227005','227006','227007','227008','227009','227010','227011','227012','227013','227014','227015','227016','227017','227018','227019','227020','227021','227022','227023','227024','227025','227026','227027','227028','227029','227030','227031','227032','227033','227034','227035','227036','227037','227038','227039','227040','227041','227042','227043','227044','227045','227046','227047','227048','227049','227050','227051','227052','227053','227054','227055','227056','227057','227058','227059','227060','227061','227062','227063','227064','227065','227066','227067','227068','227069','227070','227071','227072','227073','227074','227075','227076','227077','227078','227079','227080','227081','227082','227083','227084','227085','227086','227087','227088','227089','227090','227091','227092','227093','227094','227095','227096','227097','227098','227099','227100','227101','227102','227103','227104','227105','227106','227107','227108','227109','227110','227111','227112','227113','227114','227115','227116','227117','227118','227119','227120','227122','227123','227124','227125','227126','227127','227128','227129','227130','227131','227132','227133','227134','227135','227136','227137','227138','227139','227140','227141','227142','227143','227144','227145','227146','227147','227148','227149','227150','227151','227152','228001','229001','229002','229003','229004','229005','230001','230002','232001','233001','233002','233003','233004','233005','233006','233007','233008','234001','234002','234003','234004','234005','234006','234007','234008','234009','234010','234011','234012','234013','234014','234015','234016','234017','234018','234019','234020','234021','234022','234023','234024','234025','234026','234027','234028','234029','234030','235001','235002','235003','235004','235005','236001','236002','236003','237001','238002','238003','238004','238005','238006','238007','238008','333013','333014','333015','333016','333017','333018','333019','333020','333021','333022','333023','333024','333025','333030','333031','333032','333033','333034','333035','334001','334002','334003','334004','334005','334006','334007','336004','337001','337002','337003','337004','339001','339002','343001','344001','344002','344003','344004','344005','345001','345002','345003','347001','347002','348001','348002','348003','348004','348005','349001','349002','349003','350001','353001','353002','353003','353004','355001','355002','355003','355004','355005','355006','356001','358001','359001','359002','360001','360002','360003','360004','360005','366001','366002','366003','366004','369001','373001','373002','373003','373004','373005','373006','373007','373008','373009','373010','373011','373012','373013','373014','373015','373016','373017','373018','373019','373020','373021','374001','374002','374003','374004','374005','374006','374007','374008','374009','374010','374011','374012','374013','374014','374015','374016','376001','376002','376003','376004','376005','376006','376007','376008','376009','376010','376011','376012','376013','376016','376017','376018','376019','376020','376021','379003','382001','382002','383001','384001','384002','385001','385002','386001','386002','386003','386004','386005','386006','386007','386008','386009','386010','386011','386012','386013','386014','387001','389001','389002','389003','389004','392001','393001','393002','393003','393004','395001','396001','397001','397002','399001','399002','399003','400001','400002','401001','401002','401003','402001','402002','402003','402004','402005','403001','403002','403003','504001','504002','504004','504005','504006','504007','504008','504009','504010','504011','504012','504013','504014','504017','504018','504019','504021','504022','504023','504024','504025','506001','506002','508001','508002','511001','511002','511003','511004','511005','511006','511007','511008','511009','511010','511011','511012','511013','511014','511017','511018','511020','511021','511022','511024','511028','511029','513001','513002','513003','513004','514001','515001','515002','515003','515007','515008','515009','515010','515011','515012','515013','515014','515015','518001','518002','518003','520001','520002','521001','521002','521003','521004','521005','521006','521007','521008','521009','521010','521011','521012','521013','521014','521015','521016','523001','523002','523003','523004','523005','523006','523007','524001','700001','701001','701002','701003','702001','702002','702003','702004','702005','702006','702007','702008','703001','703002','703003','704001','704002','704003','704004','705001','706001','706002','707001','707002','707003','708001','709001','709002','710001','710002','711001','711002','712001','713001','713002','714001','714002','715001','716001','718001','718002','719001','719002','991001','991002','991003','991004','991005','991006','991007','991008','992001','995001','996001','996002','996003','998001','998002','998003','998004','998005','998006','998007','999001','999002','011017','011018','034001','034002','071010','208006','239001','519001','519003','126013','184012','053071','374017','374018','374019','374020','374021','404001','405002','405001','405003','405007','405006','405005','405004','240011','240010','240009','240008','240007','240006','240005','240004','240003','240002','240001','240012','240013','240014','240015','240016','240017','357001','235006','235007','712002','355008','355007','056023','999999','046015','019005','126014','241003','241002','241001','240018','240020','240019','242001','242002','242003','242004','242005','242006','089002','406001','406002','406003','406004','406005','406006','243001','243002','243003','243004','243005','243006','243007','243008','010030','010029','407001','407006','407005','407004','407003','407002','408001','366005','133032','016035','077010','996004','025064','011019','407007','407008','407009','409001','115123','504026','039007','039009','039008','039010','039011','039012','180072','240021','240023','408002','405008','235008','525001','525002','525003','525004','410001','410002','410003','410004','410005','410006','410007','410008','410009','410010','410011','410012','410013','410014','410015','410016','344006','240031','240030','240029','240028','240027','240026','240025','240024','240034','240033','240032','410017','410018','411001','411002','411003','411004','411005','411006','411007','411008','203020','203021','203022','412001','412002','412003','412004','069025','244001','244002','244009','244008','244007','244006','244005','244004','244003','244015','244014','244013','244012','244011','244010','244016','244017','240042','240041','240040','240039','240038','240037','240036','240035','405009','405010','240043','504034','504033','504032','504031','504030','504029','504028','504027','504042','504041','504040','504039','504038','504037','504036','504035','800001','410019','410020','410021','244018','244019','244020','399004','413001','504043','198018','198019','344007','082045','010031','010032','010033','010034','010035','504044','515016','801002','801003','801004','801005','802001','801001','414001','414002','414003','141029','141030','803001','803002','803003','803004','803005','803006','803007','803008','803009','803010','803011','803012','803013','803014','803015','803016','803017','410022','410023','803018','803019','803020','415002','415001','244021','011020','011023','011022','011021','025065','165037','165038','165039','416001','416002','416003','417001','418001','504045','803022','803021','240022','419001','420001','804010','804009','804008','804007','804006','804005','804004','804003','804002','804001','804020','804019','804018','804017','804016','804015','804014','804013','804012','804011','804024','804021','804023','804022','511019','511016','511015','511032','511031','511030','511027','511026','511025','511033','511023','133034','133033','169011','344008','344009','244022','244026','244025','244030','244023','244024','244027','244028','244029','244031','082046','082047','082048','126015','126016','416004','416005','421001','421002','016037','016036','115124','115125','115126','240049','240048','240047','240046','240045','240044','244032','244033','422001','422002','422003','422004','422005','184013','239002','805001','805002','805003','805004','805005','056024','423001','344010','235009','212014','056025','056026','802002','244034','244035','244036','244037','244038','244039','515017','504046','203015','245002','245001','071023','056027','056028','056029','056030','056031','056032','424001','056034','056033','805006','805007','805008','805009','805010','422008','422007','422006','422010','422009','422011','209004','150022','150023','100002','056035','023036','185004','185005','246001','247001','247002','425001','416006','165042','165041','165040','165043','010040','010039','010038','010037','010036','422012','422013','422014','422015','426000','248001','248002','248003','248004','248005','249001','249002','249003','249004','249005','249006','250007','250001','250002','250003','250004','250005','250006','250008','250009','250010','250011','250012','250013','251001','251002','422016','422017','422018','806001','806002','116013','235010','235011','091026','091027','091028','091029','091019','091020','091021','091022','091023','091024','091025','252001','243009','249007','249008','249009','011024','011025','427001','428002','428001','169012','429001','429002','429003') DEFAULT '001001' NOT NULL,
+ KEY field (field)
+);
+INSERT INTO t1 VALUES ('001001'),('001001'),('001001'),('001001'),('001001'),('001001'),('001001'),('001001'),('001001'),('001010'),('001010'),('001010'),('001010'),('001010'),('001018'),('001018'),('001018'),('001018'),('001018'),('001018'),('001020'),('001020'),('001020'),('001020'),('001020'),('001020'),('001020'),('001020'),('001021'),('001021'),('001021'),('001021'),('001021'),('001021'),('001027'),('001027'),('001028'),('001030'),('001030'),('001030'),('001030'),('001031'),('001031'),('001031'),('001031'),('001031'),('001100'),('001100'),('002003'),('002003'),('002003'),('002003'),('002003'),('002003'),('002003'),('002003'),('002003'),('002004'),('002004'),('002004'),('002004'),('002004'),('002004'),('002004'),('002004'),('002004'),('002005'),('002005'),('002005'),('002005'),('002005'),('002005'),('002005'),('002005'),('002007'),('002007'),('002007'),('002007'),('002007'),('002007'),('002007'),('002008'),('002008'),('002008'),('002008'),('002008'),('002008'),('002008'),('002008'),('002009'),('002009'),('002009'),('002009'),('002009'),('002009'),('002009'),('002009'),('002012'),('002012'),('002012'),('002012'),('002012'),('002012'),('002012'),('002013'),('002013'),('002013'),('002013'),('002013'),('002013'),('002013'),('002013'),('002013'),('002014'),('002014'),('002014'),('002014'),('002014'),('002014'),('002014'),('002014'),('003002'),('003002'),('003002'),('003002'),('003002'),('003002'),('003003'),('003003'),('003003'),('003003'),('003003'),('003003'),('003004'),('003004'),('003004'),('003004'),('003004'),('003004'),('003005'),('003005'),('003005'),('003005'),('003005'),('003005'),('003005'),('003005'),('003005'),('003006'),('003006'),('003006'),('003006'),('003006'),('003006'),('003006'),('003006'),('003007'),('003007'),('003007'),('003007'),('003007'),('003008'),('003008'),('003008'),('003008'),('003008'),('003008'),('003009'),('003009'),('003009'),('003009'),('003009'),('003009'),('003009'),('003009'),('003009'),('003010'),('003010'),('003010'),('003010'),('003010'),('003010'),('003010'),('003010'),('003010'),('003011'),('003011'),('003011'),('003011'),('003011'),('003011'),('003011'),('003011'),('003012'),('003012'),('003012'),('003012'),('003012'),('003012'),('003012'),('003012'),('003013'),('003013'),('003013'),('003013'),('003013'),('003013'),('003013'),('003013'),('003014'),('003014'),('003014'),('003014'),('003014'),('003014'),('003014'),('003014'),('003015'),('003015'),('003015'),('003015'),('003015'),('003015'),('003016'),('003016'),('003016'),('003016'),('003016'),('003016'),('003017'),('003017'),('003017'),('003017'),('003017'),('003018'),('003018'),('003018'),('003018'),('003018'),('003019'),('003019'),('004003'),('004005'),('004005'),('004005'),('004005'),('004005'),('004005'),('004006'),('004008'),('004010'),('004012'),('004012'),('004014'),('004014'),('004014'),('004014'),('004014'),('004016'),('004017'),('004017'),('004017'),('004017'),('004017'),('004017'),('004017'),('004017'),('004020'),('004020'),('004020'),('004020'),('004020'),('004020'),('004021'),('004021'),('004021'),('004021'),('004021'),('004021'),('004021'),('004022'),('004023'),('004023'),('004023'),('004023'),('004023'),('004023'),('004023'),('004025'),('004026'),('004026'),('004026'),('004026'),('004026'),('006004'),('006006'),('006010'),('006010'),('006010'),('006010'),('006010'),('006010'),('006010'),('006011'),('006011'),('006011'),('006011'),('006011'),('006011'),('006012'),('006012'),('006012'),('006012'),('006012'),('006012'),('006014'),('006014'),('006014'),('007001'),('007001'),('007002'),('007003'),('007005'),('007007'),('007008'),('007009'),('007011'),('007012'),('007013'),('007015'),('007016'),('007017'),('007018'),('007019'),('007019'),('007020'),('007021'),('007021'),('007022'),('007023'),('007023'),('007025'),('007025'),('007025'),('007027'),('007029'),('007031'),('007031'),('007032'),('007034'),('007034'),('007036'),('007036'),('007036'),('007037'),('007037'),('007038'),('007040'),('007040'),('007040'),('007043'),('009001'),('009001'),('009001'),('009001'),('009001'),('009001'),('009001'),('009002'),('009002'),('009002'),('009002'),('009002'),('009004'),('009004'),('009004'),('009004'),('009005'),('009005'),('009005'),('009005'),('009005'),('009005'),('009005'),('009005'),('009006'),('009006'),('009006'),('009006'),('009007'),('009007'),('009007'),('009007'),('009007'),('009007'),('009008'),('009010'),('009010'),('009010'),('009010'),('009010'),('009010'),('009011'),('009011'),('009011'),('009011'),('009011'),('009012'),('009013'),('009013'),('009013'),('010002'),('010002'),('010002'),('010002'),('010002'),('010002'),('010002'),('010002'),('010003'),('010003'),('010003'),('010003'),('010003'),('010003'),('010003'),('010003'),('010003'),('010004'),('010004'),('010004'),('010004'),('010004'),('010004'),('010004'),('010004'),('010004'),('010005'),('010005'),('010005'),('010005'),('010006'),('010006'),('010006'),('010006'),('010006'),('010006'),('010006'),('010006'),('010006'),('010007'),('010007'),('010007'),('010007'),('010007'),('010007'),('010008'),('010008'),('010008'),('010008'),('010008'),('010008'),('010008'),('010009'),('010009'),('010009'),('010009'),('010009'),('010009'),('010010'),('010010'),('010010'),('010010'),('010010'),('010010'),('010010'),('010011'),('010011'),('010011'),('010011'),('010011'),('010011'),('010011'),('010011'),('010012'),('010012'),('010012'),('010012'),('010012'),('010012'),('010012'),('010013'),('010013'),('010013'),('010013'),('010013'),('010013'),('010015'),('010016'),('010016'),('010016'),('010016'),('010016'),('010016'),('010016'),('010016'),('010017'),('010017'),('010017'),('010017'),('010017'),('010017'),('010018'),('010018'),('010018'),('010018'),('010018'),('010018'),('010018'),('010018'),('010018'),('010019'),('010019'),('010019'),('010019'),('010019'),('010019'),('010020'),('010020'),('010020'),('010021'),('010021'),('010021'),('010021'),('010021'),('010021'),('010022'),('010022'),('010022'),('010022'),('010022'),('010022'),('010022'),('010022'),('010023'),('010023'),('010023'),('010023'),('010023'),('010023'),('010023'),('010023'),('010026'),('010027'),('010028'),('010028'),('011001'),('011001'),('011001'),('011001'),('011001'),('011001'),('011001'),('011002'),('011002'),('011002'),('011002'),('011002'),('011002'),('011002'),('011003'),('011003'),('011003'),('011003'),('011003'),('011003'),('011003'),('011003'),('011004'),('011004'),('011004'),('011004'),('011004'),('011004'),('011004'),('011006'),('011006'),('011006'),('011006'),('011006'),('011006'),('011006'),('011012'),('011012'),('011012'),('011013'),('011013'),('011013'),('011013'),('011013'),('011013'),('011014'),('011014'),('011014'),('011014'),('011015'),('011015'),('011015'),('011015'),('011015'),('011016'),('011016'),('011016'),('011016'),('011016'),('012017'),('012017'),('012027'),('012027'),('012032'),('012034'),('012036'),('012036'),('012037'),('012037'),('012038'),('012039'),('014001'),('014001'),('016016'),('016016'),('016016'),('016019'),('016020'),('016020'),('016020'),('016020'),('016020'),('016020'),('016020'),('016020'),('016021'),('016021'),('016021'),('016021'),('016021'),('016021'),('016021'),('016022'),('016022'),('016022'),('016023'),('016023'),('016023'),('016024'),('016024'),('016024'),('016024'),('016024'),('016024'),('016024'),('016026'),('016026'),('016026'),('016026'),('016026'),('016026'),('016028'),('016028'),('016028'),('016028'),('016028'),('016028'),('016028'),('016029'),('016029'),('016030'),('016031'),('016032'),('016032'),('016032'),('016032'),('016032'),('016032'),('016032'),('016033'),('016033'),('016033'),('016033'),('016033'),('016034'),('016034'),('016034'),('016034'),('016034'),('017002'),('017002'),('017002'),('017002'),('017002'),('018001'),('018001'),('018001'),('018001'),('018001'),('018001'),('018001'),('018001'),('019002'),('019002'),('019002'),('019002'),('019002'),('019002'),('019004'),('019004'),('019004'),('019004'),('019004'),('019004'),('020001'),('020001'),('020001'),('020001'),('020004'),('020006'),('020006'),('020006'),('020006'),('020006'),('020006'),('020008'),('020009'),('020009'),('020009'),('020009'),('020009'),('022001'),('022001'),('022001'),('022001'),('022002'),('022002'),('022002'),('022002'),('022003'),('022003'),('022003'),('022003'),('023001'),('023002'),('023002'),('023002'),('023002'),('023002'),('023002'),('023003'),('023003'),('023003'),('023003'),('023004'),('023004'),('023005'),('023005'),('023006'),('023006'),('023006'),('023006'),('023006'),('023006'),('023007'),('023007'),('023010'),('023010'),('023011'),('023011'),('023017'),('023019'),('023019'),('023019'),('023020'),('023020'),('023025'),('023025'),('023025'),('023026'),('023026'),('023026'),('023027'),('023027'),('023027'),('023028'),('023028'),('023029'),('023029'),('023030'),('023030'),('023032'),('023033'),('023033'),('023033'),('023033'),('023033'),('023033'),('023034'),('023035'),('023035'),('025001'),('025001'),('025001'),('025001'),('025001'),('025001'),('025001'),('025003'),('025003'),('025004'),('025004'),('025005'),('025005'),('025007'),('025007'),('025008'),('025008'),('025009'),('025010'),('025010'),('025010'),('025011'),('025011'),('025012'),('025012'),('025013'),('025013'),('025013'),('025014'),('025015'),('025016'),('025018'),('025018'),('025019'),('025019'),('025020'),('025020'),('025021'),('025022'),('025022'),('025023'),('025023'),('025024'),('025025'),('025025'),('025026'),('025026'),('025027'),('025027'),('025027'),('025028'),('025030'),('025031'),('025033'),('025034'),('025035'),('025037'),('025041'),('025042'),('025043'),('025046'),('025048'),('025048'),('025048'),('025049'),('025049'),('025049'),('025050'),('025050'),('025050'),('025051'),('025051'),('025052'),('025052'),('025052'),('025053'),('025053'),('025054'),('025054'),('025054'),('025054'),('025055'),('025056'),('025056'),('025056'),('025056'),('025056'),('025056'),('025056'),('025056'),('025056'),('025057'),('025057'),('025058'),('025058'),('025060'),('025060'),('025061'),('025062'),('025063'),('027001'),('027002'),('027011'),('036001'),('036001'),('036001'),('036001'),('036001'),('037003'),('037006'),('037007'),('037008'),('037008'),('038009'),('039001'),('039001'),('039001'),('039001'),('039001'),('039001'),('039002'),('039002'),('039002'),('039002'),('039002'),('039003'),('039003'),('039003'),('039003'),('039003'),('039003'),('039004'),('039004'),('039004'),('039004'),('039004'),('039005'),('039005'),('039005'),('039005'),('039005'),('039006'),('039006'),('039006'),('039006'),('046001'),('046001'),('046001'),('046001'),('046001'),('046001'),('046001'),('046001'),('046002'),('046002'),('046002'),('046002'),('046002'),('046002'),('046002'),('046002'),('046003'),('046003'),('046003'),('046003'),('046003'),('046003'),('046003'),('046005'),('046005'),('046005'),('046005'),('046005'),('046005'),('046005'),('046007'),('046007'),('046007'),('046007'),('046007'),('046007'),('046008'),('046008'),('046008'),('046008'),('046008'),('046009'),('046009'),('046009'),('046010'),('046012'),('046012'),('046012'),('046013'),('046014'),('046014'),('046014'),('047001'),('047001'),('047001'),('047001'),('047001'),('047001'),('047001'),('047001'),('047002'),('047002'),('047002'),('047002'),('047002'),('047002'),('047002'),('047002'),('048001'),('048001'),('048001'),('048001'),('048001'),('048001'),('048001'),('048001'),('051003'),('051003'),('051003'),('051003'),('051003'),('051004'),('051004'),('051004'),('051004'),('052001'),('052001'),('052001'),('052001'),('052001'),('052001'),('052001'),('052001'),('052002'),('052002'),('052005'),('052005'),('052005'),('052005'),('052005'),('052005'),('053016'),('053019'),('053019'),('053023'),('053023'),('053023'),('053023'),('053024'),('053024'),('053024'),('053026'),('053026'),('053026'),('053026'),('053028'),('053028'),('053029'),('053029'),('053029'),('053029'),('053033'),('053033'),('053033'),('053045'),('053046'),('053051'),('053051'),('053051'),('053054'),('053054'),('053054'),('053054'),('053057'),('053069'),('053069'),('053097'),('053107'),('053125'),('053125'),('053127'),('054001'),('054001'),('054001'),('054001'),('054001'),('054001'),('054001'),('054002'),('054002'),('054002'),('054002'),('054002'),('054002'),('054003'),('054003'),('054003'),('054003'),('054003'),('054003'),('054003'),('054004'),('054004'),('054004'),('054004'),('054004'),('054004'),('054004'),('054006'),('054006'),('054006'),('054007'),('054007'),('054007'),('054007'),('054007'),('054009'),('054009'),('054009'),('054009'),('054010'),('054010'),('054010'),('054010'),('054010'),('054010'),('054010'),('056001'),('056001'),('056001'),('056001'),('056001'),('056001'),('056001'),('056001'),('056001'),('056002'),('056002'),('056002'),('056002'),('056002'),('056002'),('056002'),('056002'),('056003'),('056003'),('056003'),('056003'),('056003'),('056003'),('056004'),('056004'),('056004'),('056004'),('056004'),('056004'),('056004'),('056005'),('056005'),('056005'),('056005'),('056005'),('056005'),('056005'),('056005'),('056005'),('056006'),('056006'),('056006'),('056006'),('056006'),('056006'),('056006'),('056006'),('056006'),('056009'),('056009'),('056009'),('056011'),('056016'),('056016'),('056016'),('056016'),('056016'),('056016'),('056016'),('056017'),('056017'),('056017'),('056017'),('056017'),('056017'),('056017'),('056017'),('056017'),('056018'),('056018'),('056018'),('056018'),('056018'),('056018'),('056019'),('056019'),('056019'),('056019'),('056019'),('056019'),('056019'),('056019'),('056020'),('056020'),('056020'),('056020'),('056022'),('056022'),('056022'),('056022'),('056022'),('057003'),('057003'),('057004'),('058002'),('058002'),('058002'),('058002'),('058003'),('058003'),('058003'),('058003'),('058004'),('058004'),('058004'),('058005'),('058005'),('058005'),('060001'),('060001'),('060001'),('060001'),('060001'),('060004'),('060004'),('060004'),('060004'),('060004'),('060004'),('060005'),('060005'),('060005'),('060005'),('060005'),('060005'),('060007'),('060007'),('060007'),('060007'),('060007'),('060007'),('060007'),('061004'),('061004'),('061004'),('061004'),('061004'),('061004'),('061006'),('061006'),('061006'),('061006'),('061006'),('061006'),('069006'),('069006'),('069006'),('069006'),('069006'),('069006'),('069006'),('069006'),('069006'),('069007'),('069007'),('069007'),('069007'),('069007'),('069007'),('069007'),('069007'),('069010'),('069010'),('069010'),('069010'),('069010'),('069010'),('069011'),('069012'),('069012'),('069012'),('069012'),('069012'),('069012'),('069012'),('069012'),('069012'),('069012'),('069013'),('069013'),('069013'),('069013'),('069013'),('069013'),('069013'),('069013'),('069013'),('069014'),('069014'),('069014'),('069014'),('069014'),('069014'),('069014'),('069014'),('069014'),('069015'),('069015'),('069015'),('069015'),('069015'),('069015'),('069015'),('069015'),('069015'),('069015'),('069016'),('069016'),('069016'),('069016'),('069016'),('069018'),('069018'),('069018'),('069018'),('069018'),('069018'),('069018'),('069018'),('069018'),('069020'),('069020'),('069020'),('069020'),('069021'),('069023'),('071002'),('071002'),('071002'),('071002'),('071002'),('071003'),('071003'),('071003'),('071003'),('071003'),('071004'),('071004'),('071004'),('071004'),('071004'),('071005'),('071005'),('071005'),('071005'),('071005'),('071005'),('071006'),('071006'),('071006'),('071006'),('071008'),('071008'),('071008'),('071008'),('071008'),('071008'),('071011'),('071011'),('071011'),('071011'),('071011'),('071020'),('071020'),('071020'),('071020'),('071020'),('071021'),('071022'),('071022'),('071022'),('072001'),('072001'),('074001'),('074002'),('074002'),('074002'),('074002'),('074002'),('074002'),('074002'),('074002'),('074003'),('074003'),('074003'),('074003'),('074003'),('074003'),('074003'),('074003'),('074004'),('074004'),('074004'),('074004'),('074004'),('074004'),('074004'),('074004'),('074005'),('074005'),('074005'),('074005'),('074005'),('074005'),('074005'),('074005'),('074006'),('074006'),('074006'),('074006'),('074006'),('074006'),('074006'),('074006'),('074007'),('074007'),('074007'),('074007'),('074007'),('074007'),('074007'),('074007'),('074008'),('074008'),('074008'),('074008'),('074008'),('074008'),('074008'),('074008'),('074009'),('074009'),('074009'),('074009'),('074009'),('074009'),('074009'),('074009'),('074010'),('074010'),('074010'),('074010'),('074010'),('074010'),('074010'),('074010'),('074011'),('074011'),('074011'),('074011'),('074011'),('074011'),('074011'),('074011'),('074012'),('074012'),('074012'),('074012'),('074012'),('074012'),('074012'),('075001'),('075001'),('075001'),('075007'),('075007'),('075007'),('075007'),('076101'),('076101'),('076101'),('076101'),('076102'),('076102'),('076102'),('076103'),('076103'),('076103'),('076103'),('076103'),('077001'),('077001'),('077001'),('077002'),('077002'),('077002'),('077002'),('077002'),('077002'),('077002'),('077003'),('077003'),('077003'),('077003'),('077003'),('077003'),('077003'),('077004'),('077004'),('077004'),('077004'),('077004'),('077004'),('077006'),('077006'),('077008'),('077008'),('077008'),('077008'),('077008'),('077008'),('077008'),('077009'),('077009'),('077009'),('077009'),('077009'),('077009'),('077009'),('078005'),('078005'),('078005'),('079002'),('079002'),('079002'),('079002'),('079002'),('079002'),('079002'),('079003'),('079003'),('079004'),('079004'),('079005'),('079005'),('079005'),('079005'),('079005'),('079005'),('079006'),('079006'),('079006'),('079006'),('079007'),('079007'),('079007'),('079007'),('079007'),('081001'),('081001'),('081001'),('081001'),('081001'),('082011'),('082011'),('082011'),('082011'),('082011'),('082013'),('082013'),('082013'),('082013'),('082013'),('082013'),('082014'),('082014'),('082014'),('082014'),('082014'),('082014'),('082014'),('082015'),('082015'),('082015'),('082015'),('082015'),('082016'),('082016'),('082016'),('082016'),('082016'),('082016'),('082017'),('082017'),('082017'),('082017'),('082017'),('082017'),('082017'),('082021'),('082021'),('082022'),('082022'),('082022'),('082022'),('082022'),('082023'),('082023'),('082023'),('082023'),('082023'),('082024'),('082024'),('082024'),('082024'),('082024'),('082025'),('082025'),('082025'),('082025'),('082025'),('082026'),('082026'),('082026'),('082026'),('082026'),('082027'),('082027'),('082027'),('082027'),('082027'),('082028'),('082028'),('082028'),('082028'),('082029'),('082029'),('082029'),('082029'),('082029'),('082030'),('082030'),('082030'),('082030'),('082031'),('082031'),('082031'),('082031'),('082031'),('082032'),('082032'),('082032'),('082033'),('082033'),('082034'),('082034'),('082034'),('082034'),('082034'),('082034'),('082034'),('082035'),('082035'),('082035'),('082036'),('082036'),('082036'),('082036'),('082037'),('082037'),('082037'),('082038'),('082038'),('082038'),('082038'),('082039'),('082039'),('082039'),('082039'),('082040'),('082040'),('082040'),('082040'),('082040'),('082041'),('082041'),('082041'),('082041'),('082042'),('082042'),('082043'),('082043'),('082043'),('082043'),('082043'),('082044'),('082044'),('082044'),('082044'),('084001'),('084002'),('084002'),('084002'),('084002'),('084003'),('084003'),('084003'),('084003'),('084003'),('084003'),('084003'),('084003'),('084004'),('084004'),('084004'),('084004'),('084004'),('084005'),('084005'),('084005'),('084005'),('084005'),('084007'),('084007'),('084007'),('084007'),('084007'),('084007'),('084008'),('084008'),('084008'),('084008'),('084008'),('084008'),('084009'),('084009'),('084009'),('084009'),('084009'),('084009'),('084011'),('084013'),('084013'),('084013'),('084013'),('084013'),('084014'),('084014'),('084014'),('084016'),('084016'),('084016'),('084016'),('084016'),('084016'),('084016'),('084016'),('084017'),('084017'),('084017'),('084017'),('084017'),('084017'),('084017'),('084017'),('084017'),('084027'),('084027'),('084027'),('084027'),('084027'),('084027'),('084032'),('084032'),('084033'),('084033'),('084033'),('084035'),('084035'),('084035'),('084036'),('084036'),('084036'),('084036'),('084036'),('084036'),('084037'),('084037'),('084038'),('084038'),('084038'),('084038'),('084038'),('084038'),('084039'),('084039'),('084039'),('084039'),('084040'),('084040'),('084040'),('084040'),('084040'),('084041'),('084041'),('084041'),('084041'),('084042'),('084042'),('084043'),('084043'),('084043'),('084043'),('084044'),('084044'),('084044'),('084044'),('084044'),('084045'),('084046'),('084046'),('084046'),('084047'),('084048'),('084048'),('084049'),('084049'),('084050'),('084051'),('084051'),('085001'),('085001'),('085001'),('085001'),('085001'),('085001'),('085002'),('085002'),('085002'),('085002'),('085003'),('085003'),('085003'),('085003'),('085003'),('085003'),('085003'),('085004'),('085004'),('085004'),('085004'),('085004'),('085004'),('085004'),('085005'),('085005'),('085005'),('085005'),('085005'),('085005'),('085006'),('085006'),('085006'),('085006'),('085006'),('085006'),('085006'),('085006'),('085007'),('085007'),('085007'),('085007'),('085007'),('085007'),('085007'),('085009'),('085009'),('085009'),('085009'),('085009'),('085009'),('085011'),('085011'),('085011'),('085011'),('085011'),('085011'),('085011'),('085011'),('085012'),('085012'),('085012'),('085012'),('085012'),('085012'),('085012'),('085014'),('085014'),('085014'),('085014'),('085014'),('085014'),('085014'),('085014'),('085014'),('085015'),('085015'),('085015'),('085015'),('085015'),('085015'),('085015'),('085015'),('085016'),('085016'),('085016'),('085016'),('085016'),('085016'),('085016'),('085016'),('085017'),('085017'),('085017'),('085017'),('085017'),('085018'),('085018'),('085018'),('085018'),('085018'),('085019'),('085019'),('085019'),('085019'),('085019'),('085019'),('085019'),('085019'),('085019'),('085020'),('085020'),('085020'),('085020'),('085020'),('085020'),('085022'),('085022'),('085022'),('085022'),('085022'),('085022'),('085023'),('085023'),('085023'),('085023'),('085023'),('085028'),('085028'),('085028'),('085028'),('085028'),('085028'),('085028'),('085029'),('085029'),('085029'),('085029'),('085029'),('085029'),('085029'),('085030'),('085030'),('085030'),('085030'),('085030'),('085030'),('085030'),('085031'),('085031'),('085031'),('085031'),('085031'),('085031'),('085031'),('085033'),('085034'),('085034'),('085034'),('085034'),('085034'),('085034'),('085034'),('085035'),('085035'),('085035'),('085035'),('085035'),('085035'),('085036'),('085036'),('085036'),('085036'),('085036'),('085036'),('085037'),('085037'),('085037'),('085037'),('085037'),('085037'),('085038'),('085038'),('085038'),('085038'),('085038'),('085038'),('085038'),('085040'),('085040'),('085040'),('085040'),('085040'),('085040'),('085040'),('085040'),('085041'),('085041'),('085041'),('085041'),('085041'),('085041'),('085041'),('085041'),('085042'),('085042'),('085042'),('085042'),('085042'),('085042'),('085042'),('085043'),('085043'),('085043'),('085043'),('085043'),('085043'),('085044'),('085044'),('085044'),('085044'),('085044'),('085044'),('085044'),('085045'),('085045'),('085045'),('085045'),('085045'),('085046'),('085046'),('085046'),('085046'),('085046'),('085046'),('085046'),('085046'),('085047'),('085047'),('085047'),('085047'),('085047'),('085047'),('085047'),('085047'),('085048'),('085048'),('085048'),('085048'),('085048'),('085048'),('085048'),('085063'),('085063'),('085063'),('085063'),('085063'),('085064'),('085064'),('085064'),('085064'),('085064'),('085065'),('085065'),('085068'),('085068'),('085068'),('085068'),('085068'),('085068'),('085071'),('085071'),('085071'),('085071'),('085071'),('085071'),('085073'),('085073'),('085082'),('085082'),('085082'),('085082'),('085082'),('085086'),('085086'),('085086'),('085088'),('085088'),('085088'),('085088'),('085088'),('085088'),('085088'),('085089'),('085089'),('085090'),('085090'),('085090'),('085090'),('085090'),('085090'),('085090'),('085090'),('085091'),('085091'),('085091'),('085091'),('085091'),('085092'),('085092'),('085092'),('085093'),('085093'),('085095'),('085095'),('085095'),('085095'),('085095'),('085096'),('085096'),('085096'),('085096'),('085096'),('085096'),('085097'),('085097'),('085097'),('085097'),('085097'),('085098'),('085098'),('085098'),('085098'),('085098'),('085098'),('085098'),('085099'),('085099'),('085099'),('085099'),('085099'),('085099'),('085099'),('085100'),('085100'),('085100'),('085100'),('085100'),('085100'),('085100'),('085100'),('085100'),('085100'),('085101'),('085101'),('085101'),('085101'),('085101'),('085101'),('085101'),('085101'),('085102'),('085102'),('085103'),('085103'),('085103'),('085104'),('085104'),('085104'),('085104'),('085104'),('085105'),('085105'),('085106'),('085106'),('085106'),('085106'),('085106'),('085106'),('085108'),('085108'),('085109'),('085109'),('085109'),('085109'),('085109'),('085109'),('085109'),('085109'),('085110'),('085110'),('085110'),('085110'),('085110'),('085111'),('085111'),('085111'),('085112'),('085112'),('085112'),('085112'),('085113'),('085113'),('085113'),('085113'),('085113'),('085115'),('085120'),('085121'),('085121'),('085121'),('085121'),('085122'),('085122'),('085122'),('085122'),('085122'),('085122'),('085122'),('085122'),('085123'),('085123'),('085123'),('085123'),('085123'),('085123'),('085123'),('085123'),('085125'),('085125'),('085125'),('085125'),('085125'),('085126'),('085126'),('085126'),('085126'),('085126'),('085127'),('085127'),('085127'),('085127'),('085127'),('085127'),('085127'),('085127'),('085128'),('085128'),('085128'),('085128'),('085128'),('085129'),('085129'),('085129'),('085129'),('085129'),('085130'),('085130'),('085130'),('085130'),('085130'),('085132'),('085132'),('085132'),('085132'),('085132'),('085132'),('085133'),('085133'),('085133'),('085133'),('085133'),('085134'),('085134'),('085134'),('085135'),('085135'),('085135'),('085136'),('085136'),('085136'),('085136'),('085137'),('085137'),('085137'),('085137'),('085137'),('085137'),('085137'),('086002'),('086002'),('086002'),('086002'),('086003'),('086003'),('086003'),('086003'),('086005'),('088001'),('088001'),('088001'),('088001'),('088001'),('088003'),('088003'),('088003'),('088003'),('088003'),('088003'),('088005'),('088005'),('088005'),('088005'),('088005'),('088006'),('088006'),('088006'),('088006'),('088006'),('088007'),('088007'),('088007'),('088008'),('088008'),('088008'),('088008'),('088009'),('088009'),('088009'),('088009'),('088009'),('089001'),('089001'),('089001'),('089001'),('089001'),('089001'),('089001'),('090001'),('090001'),('090001'),('090001'),('090001'),('090001'),('090001'),('090002'),('090002'),('090002'),('090002'),('090002'),('090002'),('090003'),('090003'),('090003'),('090003'),('090003'),('090003'),('090003'),('090004'),('090004'),('090004'),('090004'),('090004'),('090004'),('090004'),('090006'),('090006'),('090006'),('090006'),('090006'),('090006'),('090006'),('090008'),('090008'),('090008'),('090008'),('090008'),('090009'),('090009'),('090009'),('090009'),('090009'),('090010'),('090010'),('090013'),('090013'),('090013'),('090016'),('090016'),('090017'),('090018'),('090022'),('090027'),('091001'),('091001'),('091001'),('091001'),('091001'),('091001'),('091002'),('091002'),('091002'),('091002'),('091002'),('091002'),('091009'),('091009'),('091009'),('091009'),('091009'),('091011'),('091011'),('091011'),('091011'),('091011'),('091011'),('091011'),('091012'),('091012'),('091013'),('091013'),('091013'),('091013'),('091013'),('091013'),('091015'),('091015'),('091015'),('091015'),('091015'),('091015'),('091016'),('091016'),('091016'),('091016'),('091016'),('091017'),('091017'),('091018'),('091018'),('091018'),('091018'),('093003'),('093003'),('093003'),('093003'),('093003'),('093003'),('099001'),('099001'),('099001'),('099001'),('099001'),('099001'),('099001'),('100001'),('100001'),('100001'),('100001'),('106001'),('113005'),('113005'),('113005'),('113006'),('113006'),('113018'),('113019'),('113020'),('115001'),('115001'),('115001'),('115002'),('115002'),('115003'),('115004'),('115004'),('115004'),('115004'),('115005'),('115005'),('115005'),('115006'),('115006'),('115006'),('115007'),('115007'),('115007'),('115007'),('115007'),('115008'),('115008'),('115008'),('115009'),('115010'),('115010'),('115010'),('115010'),('115010'),('115011'),('115011'),('115011'),('115011'),('115012'),('115012'),('115013'),('115013'),('115013'),('115014'),('115014'),('115014'),('115014'),('115015'),('115015'),('115015'),('115016'),('115016'),('115016'),('115016'),('115017'),('115017'),('115017'),('115017'),('115017'),('115018'),('115018'),('115020'),('115020'),('115021'),('115021'),('115022'),('115022'),('115022'),('115023'),('115023'),('115023'),('115023'),('115023'),('115025'),('115025'),('115025'),('115026'),('115026'),('115027'),('115027'),('115027'),('115028'),('115028'),('115028'),('115028'),('115029'),('115029'),('115029'),('115030'),('115030'),('115030'),('115031'),('115031'),('115032'),('115032'),('115032'),('115033'),('115033'),('115033'),('115033'),('115034'),('115034'),('115034'),('115035'),('115035'),('115036'),('115036'),('115036'),('115036'),('115036'),('115039'),('115040'),('115040'),('115040'),('115041'),('115041'),('115041'),('115041'),('115041'),('115042'),('115042'),('115042'),('115042'),('115042'),('115043'),('115043'),('115043'),('115044'),('115044'),('115044'),('115044'),('115046'),('115046'),('115046'),('115047'),('115048'),('115050'),('115050'),('115050'),('115050'),('115050'),('115051'),('115051'),('115051'),('115052'),('115053'),('115053'),('115054'),('115054'),('115054'),('115055'),('115055'),('115055'),('115057'),('115059'),('115059'),('115059'),('115059'),('115060'),('115060'),('115060'),('115060'),('115060'),('115060'),('115061'),('115061'),('115061'),('115062'),('115062'),('115062'),('115062'),('115064'),('115064'),('115064'),('115065'),('115065'),('115065'),('115065'),('115066'),('115066'),('115066'),('115067'),('115067'),('115067'),('115068'),('115068'),('115068'),('115069'),('115069'),('115069'),('115069'),('115069'),('115070'),('115070'),('115070'),('115071'),('115071'),('115071'),('115072'),('115072'),('115072'),('115073'),('115073'),('115075'),('115075'),('115075'),('115076'),('115076'),('115076'),('115076'),('115076'),('115076'),('115081'),('115081'),('115081'),('115082'),('115082'),('115082'),('115085'),('115085'),('115085'),('115085'),('115085'),('115086'),('115086'),('115086'),('115087'),('115087'),('115088'),('115088'),('115088'),('115088'),('115088'),('115095'),('115095'),('115095'),('115096'),('115096'),('115097'),('115097'),('115098'),('115098'),('115099'),('115101'),('115102'),('115102'),('115102'),('115103'),('115103'),('115104'),('115104'),('115104'),('115104'),('115105'),('115105'),('115106'),('115106'),('115106'),('115106'),('115106'),('115108'),('115109'),('115111'),('115111'),('115111'),('115111'),('115112'),('115112'),('115112'),('115112'),('115112'),('115113'),('115113'),('115113'),('115114'),('115114'),('115114'),('115114'),('115114'),('115115'),('115115'),('115115'),('115115'),('115116'),('115117'),('115117'),('115117'),('115118'),('115118'),('115119'),('115119'),('115119'),('115119'),('115120'),('115121'),('115121'),('115122'),('115122'),('116001'),('116003'),('116003'),('116003'),('116003'),('116004'),('116004'),('116005'),('116005'),('116006'),('116006'),('116006'),('116007'),('116007'),('116008'),('116008'),('116009'),('116009'),('116009'),('116010'),('116010'),('116010'),('116010'),('116011'),('116011'),('116011'),('116011'),('116012'),('116012'),('123001'),('123001'),('123001'),('123001'),('123001'),('124065'),('126001'),('126001'),('126001'),('126001'),('126001'),('126001'),('126001'),('126001'),('126002'),('126002'),('126002'),('126002'),('126002'),('126002'),('126002'),('126002'),('126003'),('126003'),('126003'),('126003'),('126003'),('126003'),('126003'),('126003'),('126003'),('126004'),('126004'),('126004'),('126004'),('126004'),('126004'),('126004'),('126004'),('126004'),('126004'),('126005'),('126005'),('126005'),('126005'),('126005'),('126005'),('126005'),('126005'),('126005'),('126006'),('126006'),('126006'),('126006'),('126006'),('126006'),('126006'),('126006'),('126006'),('126007'),('126007'),('126007'),('126007'),('126007'),('126007'),('126007'),('126008'),('126008'),('126008'),('126008'),('126008'),('126008'),('126008'),('126008'),('126009'),('126009'),('126009'),('126009'),('126009'),('126009'),('126009'),('126009'),('126010'),('126010'),('126010'),('126010'),('126010'),('126010'),('126010'),('126010'),('126010'),('126011'),('126011'),('126011'),('126011'),('126011'),('126011'),('126011'),('126012'),('126012'),('126012'),('126012'),('130001'),('130001'),('130001'),('130001'),('132001'),('132001'),('132001'),('132001'),('132001'),('132002'),('132002'),('132002'),('132002'),('132002'),('132002'),('132002'),('133001'),('133001'),('133008'),('133009'),('133010'),('133011'),('133011'),('133011'),('133011'),('133011'),('133011'),('133012'),('133015'),('133015'),('133015'),('133015'),('133016'),('133018'),('133018'),('133018'),('133018'),('133018'),('133019'),('133021'),('133021'),('133022'),('133022'),('133023'),('133023'),('133024'),('133024'),('133024'),('133024'),('133024'),('133024'),('133025'),('133027'),('133027'),('133027'),('133027'),('133027'),('133028'),('133028'),('133028'),('133029'),('133029'),('133029'),('133029'),('133029'),('133029'),('133030'),('133030'),('133031'),('133031'),('133031'),('134001'),('134001'),('134001'),('135001'),('135001'),('135001'),('135001'),('135001'),('135002'),('135002'),('135002'),('135004'),('135010'),('135010'),('135010'),('135010'),('135010'),('135010'),('137010'),('137011'),('137012'),('137014'),('137015'),('137015'),('137016'),('137019'),('139001'),('140001'),('140001'),('140001'),('140001'),('140001'),('140001'),('141001'),('141001'),('141001'),('141001'),('141001'),('141002'),('141002'),('141002'),('141002'),('141002'),('141003'),('141003'),('141003'),('141003'),('141003'),('141003'),('141003'),('141003'),('141006'),('141006'),('141006'),('141006'),('141006'),('141006'),('141006'),('141006'),('141007'),('141007'),('141007'),('141007'),('141007'),('141009'),('141009'),('141009'),('141009'),('141009'),('141011'),('141011'),('141011'),('141011'),('141011'),('141011'),('141012'),('141014'),('141014'),('141014'),('141014'),('141014'),('141014'),('141014'),('141014'),('141015'),('141015'),('141015'),('141015'),('141015'),('141016'),('141016'),('141016'),('141016'),('141016'),('141016'),('141017'),('141017'),('141017'),('141017'),('141017'),('141017'),('141018'),('141018'),('141018'),('141018'),('141019'),('141019'),('141019'),('141019'),('141020'),('141020'),('141020'),('141020'),('141020'),('141020'),('141020'),('141021'),('141021'),('141021'),('141021'),('141021'),('141021'),('141022'),('141022'),('141022'),('141022'),('141022'),('141022'),('141023'),('141023'),('141023'),('141023'),('141023'),('141023'),('141023'),('141024'),('141025'),('141025'),('141025'),('141026'),('141026'),('141026'),('141026'),('141026'),('141026'),('141027'),('141027'),('141027'),('141027'),('141027'),('141028'),('141028'),('145001'),('145001'),('145001'),('145001'),('145001'),('145001'),('145001'),('145001'),('145001'),('145002'),('145002'),('145002'),('145002'),('145002'),('145002'),('145002'),('145002'),('145002'),('145003'),('145003'),('145003'),('145003'),('145003'),('145003'),('145003'),('145003'),('145003'),('145003'),('145004'),('145004'),('145004'),('145004'),('145004'),('145004'),('145004'),('145004'),('145004'),('145005'),('145005'),('145005'),('145005'),('145005'),('145005'),('145005'),('145005'),('145005'),('145006'),('145006'),('145006'),('145006'),('145006'),('145006'),('145006'),('145006'),('145006'),('145008'),('145008'),('145008'),('145008'),('145008'),('145008'),('145008'),('145008'),('145009'),('145009'),('145009'),('145009'),('145009'),('145009'),('145009'),('145011'),('145011'),('145011'),('145011'),('145011'),('145011'),('145011'),('145011'),('145012'),('145012'),('145012'),('145012'),('145012'),('145012'),('145012'),('145012'),('145013'),('145013'),('145013'),('145013'),('145013'),('145013'),('145013'),('150009'),('150013'),('150014'),('150015'),('150015'),('150015'),('150016'),('150016'),('150017'),('150017'),('150017'),('150017'),('150020'),('152001'),('152001'),('152001'),('152002'),('152003'),('152003'),('152003'),('152003'),('152004'),('152005'),('152006'),('152006'),('152006'),('152006'),('152007'),('154001'),('154002'),('154002'),('155001'),('155001'),('155002'),('155003'),('155004'),('155004'),('155006'),('159001'),('159003'),('160001'),('160001'),('160001'),('160001'),('160002'),('160002'),('161001'),('162002'),('162002'),('162003'),('162003'),('162003'),('162003'),('162003'),('162007'),('162012'),('162012'),('162012'),('163001'),('163001'),('163001'),('163011'),('163015'),('163016'),('163016'),('165001'),('165001'),('165001'),('165001'),('165002'),('165002'),('165002'),('165002'),('165003'),('165003'),('165003'),('165004'),('165004'),('165004'),('165005'),('165005'),('165005'),('165006'),('165006'),('165006'),('165006'),('165007'),('165007'),('165007'),('165007'),('165008'),('165008'),('165008'),('165008'),('165009'),('165009'),('165009'),('165009'),('165010'),('165010'),('165010'),('165011'),('165011'),('165012'),('165012'),('165012'),('165013'),('165013'),('165013'),('165014'),('165014'),('165014'),('165015'),('165015'),('165015'),('165015'),('165016'),('165016'),('165016'),('165017'),('165017'),('165017'),('165017'),('165018'),('165018'),('165018'),('165018'),('165019'),('165019'),('165019'),('165019'),('165020'),('165020'),('165020'),('165020'),('165021'),('165021'),('165021'),('165021'),('165022'),('165022'),('165022'),('165023'),('165024'),('165024'),('165024'),('165025'),('165025'),('165025'),('165026'),('165026'),('165026'),('165028'),('165029'),('165030'),('165030'),('165030'),('165031'),('165031'),('165033'),('165033'),('165034'),('165034'),('165034'),('165035'),('165035'),('165035'),('165036'),('165036'),('165036'),('168003'),('168003'),('168004'),('168005'),('168014'),('169001'),('169001'),('169001'),('169001'),('169001'),('169001'),('169001'),('169001'),('169001'),('169001'),('169002'),('169002'),('169002'),('169002'),('169002'),('169002'),('169002'),('169002'),('169002'),('169002'),('169003'),('169003'),('169003'),('169003'),('169007'),('169007'),('169007'),('169007'),('169007'),('169007'),('169007'),('169007'),('169007'),('169007'),('169008'),('169008'),('169008'),('169008'),('169008'),('169008'),('169008'),('169009'),('169009'),('169009'),('169009'),('169010'),('171006'),('171006'),('171007'),('171007'),('171008'),('171008'),('171008'),('171009'),('171009'),('171009'),('172001'),('176001'),('176001'),('176001'),('176001'),('176001'),('176001'),('176001'),('176002'),('176002'),('176002'),('176002'),('176002'),('176003'),('176003'),('176003'),('176003'),('176003'),('176003'),('177001'),('177001'),('177001'),('177001'),('177001'),('177001'),('179007'),('179007'),('179012'),('179012'),('179012'),('179012'),('179012'),('179012'),('179013'),('179013'),('179013'),('179013'),('179013'),('179013'),('179042'),('179044'),('179045'),('180001'),('180013'),('180014'),('180014'),('180015'),('180017'),('180018'),('180020'),('180020'),('180021'),('180021'),('180027'),('180030'),('180033'),('180035'),('180036'),('180037'),('180038'),('180041'),('180042'),('180045'),('180045'),('180047'),('180048'),('180049'),('180050'),('180054'),('180060'),('180066'),('180067'),('180068'),('180070'),('182001'),('184001'),('184002'),('184005'),('184005'),('184005'),('184005'),('184006'),('184006'),('184006'),('184006'),('184008'),('184008'),('184008'),('184008'),('184009'),('184009'),('184009'),('184009'),('184010'),('184010'),('184010'),('184010'),('184011'),('184011'),('184011'),('184011'),('185001'),('185001'),('185001'),('185001'),('185001'),('185001'),('185001'),('185003'),('185003'),('185003'),('185003'),('185003'),('185003'),('185003'),('187001'),('191002'),('191002'),('192002'),('194003'),('197001'),('197001'),('197001'),('197001'),('197001'),('197001'),('197001'),('197002'),('197002'),('197002'),('197002'),('197002'),('197002'),('197002'),('197003'),('197003'),('197003'),('197003'),('197003'),('197003'),('197003'),('197004'),('197004'),('197004'),('197004'),('197004'),('197004'),('197004'),('197005'),('197005'),('197005'),('197005'),('197005'),('197005'),('197006'),('197006'),('197006'),('197006'),('197006'),('198001'),('198001'),('198001'),('198001'),('198001'),('198001'),('198003'),('198003'),('198003'),('198004'),('198004'),('198004'),('198004'),('198004'),('198004'),('198005'),('198005'),('198005'),('198005'),('198005'),('198005'),('198005'),('198006'),('198006'),('198006'),('198006'),('198006'),('198006'),('198007'),('198007'),('198007'),('198007'),('198007'),('198007'),('198007'),('198008'),('198008'),('198008'),('198008'),('198008'),('198008'),('198009'),('198009'),('198009'),('198009'),('198009'),('198009'),('198009'),('198010'),('198010'),('198010'),('198010'),('198010'),('198010'),('198011'),('198012'),('198012'),('198012'),('198012'),('198015'),('198015'),('198016'),('198016'),('198016'),('198016'),('198016'),('198016'),('198017'),('198017'),('198017'),('198017'),('198017'),('198017'),('201001'),('201001'),('201001'),('201001'),('201001'),('201002'),('202001'),('202001'),('203001'),('203001'),('203001'),('203001'),('203001'),('203001'),('203001'),('203002'),('203002'),('203002'),('203002'),('203003'),('203003'),('203003'),('203003'),('203003'),('203017'),('203017'),('203017'),('203017'),('203017'),('203017'),('203017'),('203017'),('203017'),('203018'),('203018'),('203018'),('203018'),('203018'),('203019'),('203019'),('203019'),('203019'),('203019'),('204001'),('204002'),('205001'),('205001'),('205001'),('205001'),('205001'),('205001'),('205001'),('208001'),('208001'),('208002'),('208002'),('208002'),('208003'),('208003'),('208003'),('208004'),('208004'),('208004'),('208004'),('208004'),('208004'),('208004'),('208005'),('208005'),('208005'),('208005'),('208005'),('209001'),('209001'),('209001'),('209001'),('209001'),('209002'),('209002'),('209002'),('209002'),('209002'),('209003'),('209003'),('209003'),('209003'),('209003'),('210001'),('210001'),('210001'),('210001'),('210001'),('210004'),('210004'),('210004'),('210004'),('210004'),('210004'),('210009'),('210010'),('212001'),('212001'),('212002'),('212002'),('212002'),('212002'),('212003'),('212003'),('212003'),('212004'),('212004'),('212004'),('212005'),('212005'),('212005'),('212005'),('212005'),('212006'),('212006'),('212006'),('212007'),('212007'),('212008'),('212008'),('212008'),('212008'),('212009'),('212009'),('212009'),('212009'),('212010'),('212010'),('212010'),('212010'),('212011'),('212011'),('212012'),('212012'),('212013'),('212013'),('212013'),('218001'),('218004'),('218009'),('218011'),('218011'),('218015'),('218020'),('218021'),('218021'),('218022'),('218022'),('218022'),('218023'),('218024'),('218025'),('218026'),('218026'),('218027'),('218028'),('218029'),('218029'),('218029'),('218030'),('218031'),('221001'),('221001'),('221001'),('221001'),('221001'),('221001'),('221002'),('221002'),('221002'),('221002'),('221002'),('221002'),('221003'),('221003'),('221003'),('221003'),('221003'),('221003'),('221004'),('221004'),('221004'),('221004'),('221004'),('221004'),('221005'),('221005'),('221005'),('221005'),('221005'),('221006'),('221006'),('221006'),('221006'),('221006'),('221007'),('221007'),('221007'),('221007'),('221007'),('221007'),('221008'),('221008'),('221008'),('221008'),('221008'),('221008'),('221009'),('221009'),('221009'),('221009'),('221009'),('221009'),('221010'),('221010'),('221010'),('221010'),('221011'),('221011'),('221011'),('221011'),('221012'),('221012'),('221012'),('221012'),('221012'),('221012'),('221013'),('221013'),('221013'),('221013'),('221013'),('221013'),('223003'),('223003'),('224001'),('224001'),('224002'),('224002'),('224003'),('224007'),('224008'),('225001'),('225002'),('225002'),('225002'),('225003'),('225003'),('225003'),('225003'),('225004'),('225004'),('225004'),('225005'),('225005'),('225005'),('225005'),('225005'),('225005'),('225006'),('225006'),('225006'),('225007'),('225007'),('225007'),('225008'),('225008'),('225008'),('225008'),('225008'),('225009'),('225009'),('225009'),('225010'),('225010'),('225010'),('225011'),('225011'),('225011'),('225011'),('225011'),('225012'),('225012'),('225012'),('225012'),('225012'),('225012'),('225013'),('225013'),('226001'),('226002'),('226003'),('226003'),('226005'),('226005'),('226006'),('226007'),('226007'),('226007'),('226007'),('227011'),('227015'),('227015'),('227041'),('227045'),('227052'),('227056'),('227063'),('227064'),('227066'),('227067'),('227069'),('227071'),('227073'),('227085'),('227116'),('227119'),('227131'),('227133'),('227147'),('229005'),('229005'),('229005'),('233003'),('233004'),('235001'),('235001'),('235002'),('235003'),('235003'),('235003'),('235004'),('235005'),('235005'),('235005'),('235005'),('235005'),('235005'),('235005'),('236001'),('236001'),('236001'),('236001'),('236002'),('236003'),('236003'),('236003'),('236003'),('236003'),('236003'),('238002'),('238002'),('238002'),('238002'),('238002'),('238002'),('238003'),('238003'),('238003'),('238003'),('238003'),('238003'),('238004'),('238004'),('238004'),('238004'),('238004'),('238005'),('238005'),('238005'),('238007'),('238007'),('238007'),('238007'),('238007'),('238007'),('238007'),('238008'),('238008'),('238008'),('238008'),('238008'),('238008'),('238008'),('334005'),('334006'),('337001'),('337001'),('337001'),('337002'),('337002'),('337003'),('337003'),('337003'),('337004'),('343001'),('343001'),('344001'),('344002'),('344003'),('344004'),('344005'),('344005'),('345001'),('345001'),('348001'),('348004'),('348005'),('348005'),('349001'),('349001'),('349002'),('349002'),('349002'),('350001'),('353002'),('353002'),('353002'),('353003'),('355001'),('355002'),('355005'),('355006'),('355006'),('356001'),('358001'),('358001'),('358001'),('359001'),('359001'),('359002'),('359002'),('359002'),('359002'),('360001'),('360001'),('360002'),('360002'),('360003'),('360003'),('360004'),('360004'),('360005'),('360005'),('360005'),('366001'),('366002'),('366002'),('366003'),('366004'),('369001'),('369001'),('373001'),('373002'),('373002'),('373003'),('373003'),('373005'),('373007'),('373008'),('373009'),('373009'),('373010'),('373010'),('373010'),('373011'),('373011'),('373011'),('373011'),('373012'),('373012'),('373012'),('373013'),('373013'),('373014'),('373014'),('373015'),('373015'),('373015'),('373015'),('373017'),('373017'),('373017'),('373017'),('373018'),('373021'),('374002'),('374004'),('374006'),('374007'),('374008'),('374009'),('374010'),('374011'),('374012'),('374015'),('374016'),('382001'),('382002'),('382002'),('384001'),('386001'),('386001'),('386001'),('386001'),('386001'),('386001'),('386001'),('386002'),('386002'),('386002'),('386002'),('386002'),('386002'),('386002'),('386003'),('386003'),('386003'),('386003'),('386003'),('386003'),('386003'),('386003'),('386003'),('386004'),('386004'),('386004'),('386004'),('386004'),('386004'),('386004'),('386004'),('386005'),('386005'),('386005'),('386005'),('386005'),('386005'),('386005'),('386006'),('386006'),('386006'),('386006'),('386006'),('386006'),('386007'),('386007'),('386007'),('386007'),('386007'),('386007'),('386007'),('386007'),('386007'),('386008'),('386008'),('386008'),('386008'),('386008'),('386008'),('386008'),('386008'),('386009'),('386009'),('386009'),('386010'),('386010'),('386010'),('386010'),('386010'),('386010'),('386010'),('386010'),('386011'),('386011'),('386011'),('386011'),('386011'),('386011'),('386011'),('386011'),('386011'),('386012'),('386012'),('386012'),('386012'),('386012'),('386012'),('386012'),('386012'),('386012'),('386013'),('386013'),('386013'),('386013'),('386013'),('386013'),('386013'),('386014'),('386014'),('386014'),('386014'),('389001'),('389002'),('389002'),('389003'),('389003'),('389003'),('389003'),('389004'),('389004'),('389004'),('389004'),('392001'),('393001'),('393002'),('393002'),('393003'),('393004'),('395001'),('395001'),('397001'),('397001'),('397001'),('397002'),('399001'),('399001'),('399001'),('399001'),('399001'),('399001'),('399001'),('399002'),('399002'),('399002'),('399002'),('399002'),('399002'),('399002'),('399003'),('400001'),('400001'),('400001'),('400001'),('400002'),('403002'),('504001'),('504001'),('504002'),('504002'),('504002'),('504004'),('504004'),('504005'),('504006'),('504007'),('504007'),('504007'),('504008'),('504008'),('504009'),('504009'),('504009'),('504009'),('504009'),('504010'),('504011'),('504011'),('504012'),('504012'),('504014'),('504014'),('504014'),('504014'),('504014'),('504014'),('504014'),('504014'),('504017'),('504017'),('504021'),('504021'),('504021'),('504021'),('504021'),('504021'),('504021'),('504022'),('504023'),('504023'),('504024'),('504024'),('504025'),('504025'),('506001'),('506001'),('506001'),('506001'),('506001'),('506001'),('506002'),('506002'),('506002'),('506002'),('506002'),('511001'),('511001'),('511001'),('511001'),('511001'),('511001'),('511001'),('511002'),('511002'),('511002'),('511002'),('511002'),('511002'),('511002'),('511003'),('511003'),('511003'),('511003'),('511003'),('511003'),('511004'),('511004'),('511004'),('511004'),('511004'),('511004'),('511004'),('511005'),('511005'),('511005'),('511005'),('511005'),('511005'),('511005'),('511006'),('511006'),('511006'),('511006'),('511006'),('511006'),('511006'),('511007'),('511007'),('511007'),('511007'),('511007'),('511008'),('511008'),('511008'),('511008'),('511008'),('511008'),('511009'),('511009'),('511009'),('511009'),('511009'),('511009'),('511010'),('511010'),('511010'),('511010'),('511010'),('511010'),('511011'),('511011'),('511011'),('511011'),('511011'),('511011'),('511012'),('511012'),('511012'),('511012'),('511012'),('511012'),('511012'),('511013'),('511013'),('511013'),('511013'),('511013'),('511013'),('511013'),('511014'),('511014'),('511014'),('511014'),('511014'),('511017'),('511018'),('511020'),('511021'),('511022'),('511024'),('511028'),('511029'),('511029'),('511029'),('511029'),('511029'),('511029'),('513001'),('513001'),('513001'),('513001'),('513001'),('513001'),('513001'),('513001'),('513002'),('513002'),('513002'),('513002'),('513002'),('513002'),('513003'),('513003'),('513003'),('513003'),('513003'),('513003'),('513003'),('513003'),('513004'),('513004'),('513004'),('515001'),('515001'),('515001'),('515001'),('515001'),('515002'),('515002'),('515003'),('515003'),('515007'),('515007'),('515008'),('515011'),('515011'),('515011'),('515011'),('515011'),('515011'),('515012'),('515012'),('515012'),('515012'),('515013'),('515013'),('515013'),('515013'),('515013'),('515014'),('515014'),('515014'),('515014'),('515014'),('515015'),('515015'),('515015'),('515015'),('515015'),('518001'),('518002'),('521001'),('521002'),('521002'),('521002'),('521003'),('521003'),('521003'),('521003'),('521004'),('521004'),('521004'),('521004'),('521005'),('521005'),('521005'),('521005'),('521006'),('521006'),('521006'),('521009'),('521010'),('521010'),('521010'),('521010'),('521011'),('521011'),('521011'),('521011'),('521012'),('521013'),('521013'),('521015'),('521016'),('521016'),('523001'),('523001'),('523001'),('523001'),('523001'),('523001'),('523001'),('523002'),('523002'),('523002'),('523002'),('523002'),('523002'),('523003'),('523003'),('523003'),('523003'),('523003'),('523003'),('523003'),('523004'),('523004'),('523004'),('523004'),('523004'),('523004'),('523005'),('523005'),('523005'),('523005'),('523005'),('523005'),('523005'),('523005'),('523006'),('523006'),('523006'),('523006'),('523006'),('523006'),('523006'),('523007'),('523007'),('523007'),('523007'),('523007'),('523007'),('523007'),('524001'),('700001'),('701001'),('701002'),('701003'),('702001'),('702002'),('702004'),('702005'),('704001'),('704004'),('705001'),('706001'),('706002'),('707001'),('707002'),('707003'),('708001'),('710001'),('710002'),('711001'),('711002'),('712001'),('714001'),('714002'),('715001'),('719001'),('719002'),('991002'),('991002'),('991002'),('991003'),('991003'),('991003'),('991003'),('991003'),('991003'),('991003'),('991004'),('991004'),('991004'),('991005'),('991005'),('991005'),('991006'),('991007'),('995001'),('995001'),('995001'),('995001'),('995001'),('995001'),('995001'),('995001'),('995001'),('995001'),('995001'),('996001'),('996001'),('996001'),('996001'),('996001'),('996001'),('996001'),('996001'),('996002'),('996002'),('996003'),('996003'),('996003'),('996003'),('996003'),('998001'),('998001'),('998001'),('998001'),('998001'),('998001'),('998001'),('998001'),('998001'),('998001'),('998002'),('998002'),('998002'),('998002'),('998002'),('998002'),('998002'),('998002'),('998002'),('998002'),('998003'),('998003'),('998003'),('998003'),('998003'),('998003'),('998003'),('998003'),('998004'),('998004'),('998005'),('998005'),('998006'),('998007'),('999001'),('999001'),('999001'),('999001'),('999001'),('999001'),('999001'),('999001'),('999001'),('999001'),('999001'),('999002'),('999002'),('011017'),('011017'),('011017'),('011017'),('011017'),('011017'),('011017'),('011018'),('011018'),('011018'),('011018'),('034001'),('034001'),('034002'),('034002'),('071010'),('071010'),('071010'),('519001'),('126013'),('126013'),('126013'),('126013'),('126013'),('184012'),('184012'),('184012'),('404001'),('405002'),('405002'),('405001'),('405003'),('405006'),('240011'),('240011'),('240011'),('240011'),('240011'),('240011'),('240010'),('240010'),('240010'),('240009'),('240009'),('240009'),('240009'),('240008'),('240008'),('240008'),('240007'),('240007'),('240007'),('240007'),('240007'),('240007'),('240005'),('240005'),('240005'),('240005'),('240005'),('240004'),('240004'),('240004'),('240004'),('240004'),('240003'),('240003'),('240003'),('240003'),('240002'),('240002'),('240002'),('240002'),('240002'),('240002'),('240002'),('240001'),('240001'),('240001'),('240001'),('240001'),('240012'),('240012'),('240012'),('240012'),('240012'),('240013'),('240014'),('240015'),('240015'),('240015'),('240015'),('240015'),('240015'),('240015'),('240015'),('240016'),('240016'),('240016'),('240016'),('240016'),('240016'),('240017'),('240017'),('240017'),('357001'),('357001'),('235006'),('235006'),('235007'),('235007'),('235007'),('235007'),('235007'),('056023'),('056023'),('056023'),('056023'),('056023'),('046015'),('019005'),('019005'),('126014'),('126014'),('126014'),('126014'),('126014'),('126014'),('241003'),('241003'),('241003'),('241003'),('241003'),('241003'),('241002'),('241002'),('241002'),('241002'),('241002'),('241002'),('241001'),('241001'),('241001'),('241001'),('241001'),('240020'),('240020'),('240020'),('240020'),('240020'),('240020'),('240019'),('240019'),('240019'),('242001'),('242002'),('242004'),('242005'),('242006'),('089002'),('089002'),('089002'),('089002'),('089002'),('089002'),('406001'),('406002'),('406003'),('406004'),('406004'),('243001'),('243005'),('243006'),('243007'),('243008'),('408001'),('408001'),('408001'),('408001'),('408001'),('366005'),('366005'),('016035'),('016035'),('016035'),('016035'),('077010'),('996004'),('996004'),('996004'),('996004'),('996004'),('996004'),('996004'),('996004'),('025064'),('025064'),('025064'),('025064'),('011019'),('011019'),('011019'),('011019'),('011019'),('115123'),('115123'),('504026'),('039007'),('039009'),('039008'),('039008'),('039010'),('039010'),('039011'),('039012'),('180072'),('240021'),('240021'),('240021'),('240021'),('240021'),('240021'),('240021'),('240023'),('240023'),('240023'),('240023'),('405008'),('405008'),('525002'),('410002'),('410002'),('410004'),('410005'),('410005'),('410006'),('410007'),('410007'),('410008'),('410009'),('410010'),('410011'),('410011'),('410012'),('410012'),('410013'),('410013'),('410014'),('410014'),('410016'),('410016'),('344006'),('240031'),('240031'),('240031'),('240031'),('240030'),('240030'),('240030'),('240030'),('240029'),('240029'),('240029'),('240029'),('240028'),('240028'),('240028'),('240028'),('240027'),('240027'),('240026'),('240026'),('240026'),('240025'),('240025'),('240025'),('240025'),('240024'),('240024'),('240034'),('240034'),('240034'),('240033'),('240033'),('240033'),('240032'),('240032'),('240032'),('240032'),('411001'),('411002'),('203020'),('069025'),('069025'),('069025'),('069025'),('069025'),('069025'),('244001'),('244001'),('244001'),('244001'),('244001'),('244001'),('244001'),('244001'),('244001'),('244001'),('244001'),('244002'),('244002'),('244002'),('244002'),('244002'),('244002'),('244002'),('244002'),('244002'),('244002'),('244002'),('244009'),('244009'),('244009'),('244009'),('244009'),('244009'),('244009'),('244009'),('244009'),('244009'),('244009'),('244008'),('244008'),('244008'),('244008'),('244008'),('244008'),('244008'),('244008'),('244008'),('244008'),('244008'),('244007'),('244007'),('244007'),('244007'),('244007'),('244007'),('244007'),('244007'),('244007'),('244007'),('244007'),('244006'),('244006'),('244006'),('244006'),('244006'),('244006'),('244006'),('244006'),('244006'),('244006'),('244006'),('244004'),('244004'),('244004'),('244004'),('244004'),('244004'),('244004'),('244004'),('244004'),('244004'),('244004'),('244003'),('244003'),('244003'),('244003'),('244003'),('244003'),('244003'),('244003'),('244003'),('244003'),('244003'),('244014'),('244014'),('244014'),('244014'),('244014'),('244014'),('244014'),('244014'),('244013'),('244013'),('244013'),('244013'),('244013'),('244013'),('244013'),('244013'),('244012'),('244012'),('244012'),('244012'),('244012'),('244012'),('244012'),('244012'),('244011'),('244011'),('244011'),('244011'),('244011'),('244011'),('244011'),('244011'),('244016'),('244016'),('244016'),('244016'),('244016'),('244016'),('244016'),('244016'),('244016'),('244016'),('244016'),('244017'),('244017'),('244017'),('244017'),('244017'),('244017'),('244017'),('244017'),('244017'),('240040'),('240037'),('405009'),('405009'),('405009'),('405010'),('405010'),('240043'),('240043'),('504028'),('504040'),('800001'),('410019'),('410019'),('410020'),('410020'),('410020'),('410021'),('410021'),('244018'),('244018'),('244018'),('244018'),('244018'),('244018'),('244018'),('244018'),('244018'),('244018'),('244018'),('244019'),('244019'),('244019'),('244019'),('244019'),('244019'),('244019'),('244019'),('244019'),('244019'),('244019'),('244020'),('244020'),('244020'),('244020'),('244020'),('244020'),('244020'),('244020'),('413001'),('344007'),('082045'),('082045'),('082045'),('082045'),('082045'),('010031'),('010031'),('010031'),('010031'),('010032'),('010032'),('010032'),('010032'),('010033'),('010033'),('010033'),('010033'),('010033'),('010034'),('010034'),('010034'),('010034'),('010035'),('010035'),('010035'),('010035'),('504044'),('515016'),('515016'),('515016'),('515016'),('801002'),('801003'),('801004'),('801005'),('802001'),('801001'),('414001'),('141029'),('803001'),('803002'),('803004'),('803005'),('803006'),('803007'),('803008'),('803009'),('803013'),('803014'),('803015'),('803016'),('803017'),('410022'),('410023'),('410023'),('803019'),('415002'),('415001'),('244021'),('244021'),('244021'),('244021'),('244021'),('244021'),('244021'),('011020'),('011020'),('011020'),('011020'),('011023'),('011023'),('011023'),('011023'),('011022'),('011022'),('011022'),('011022'),('011022'),('011022'),('011021'),('011021'),('011021'),('011021'),('025065'),('025065'),('025065'),('025065'),('165037'),('165037'),('165038'),('165038'),('165038'),('165039'),('416001'),('416001'),('416001'),('416001'),('416001'),('416002'),('416003'),('417001'),('418001'),('504045'),('504045'),('504045'),('803022'),('240022'),('240022'),('240022'),('240022'),('420001'),('420001'),('420001'),('420001'),('804010'),('804005'),('804002'),('804018'),('804013'),('511019'),('511016'),('511015'),('511032'),('511031'),('511030'),('511027'),('511026'),('511025'),('511033'),('511023'),('133034'),('133034'),('133034'),('133033'),('169011'),('169011'),('169011'),('169011'),('169011'),('344008'),('244022'),('244022'),('244022'),('244022'),('244022'),('244022'),('244022'),('244026'),('244026'),('244026'),('244026'),('244026'),('244026'),('244025'),('244025'),('244025'),('244025'),('244025'),('244025'),('244025'),('244025'),('244030'),('244030'),('244030'),('244030'),('244030'),('244030'),('244030'),('244030'),('244023'),('244023'),('244023'),('244023'),('244023'),('244023'),('244024'),('244024'),('244024'),('244024'),('244024'),('244024'),('244024'),('244024'),('244027'),('244027'),('244027'),('244027'),('244027'),('244027'),('244027'),('244027'),('244028'),('244028'),('244028'),('244028'),('244028'),('244028'),('244028'),('244028'),('244029'),('244029'),('244029'),('244029'),('244029'),('244029'),('244029'),('244029'),('244031'),('244031'),('244031'),('244031'),('244031'),('244031'),('244031'),('244031'),('082046'),('082046'),('082046'),('082046'),('082047'),('082047'),('082048'),('082048'),('126015'),('126015'),('126016'),('126016'),('126016'),('126016'),('126016'),('416005'),('421001'),('421001'),('421002'),('016037'),('016037'),('016037'),('016037'),('016036'),('016036'),('016036'),('016036'),('115124'),('115124'),('115126'),('240049'),('240049'),('240048'),('240048'),('240047'),('240047'),('240046'),('240046'),('240045'),('240044'),('244032'),('244033'),('422002'),('422004'),('422004'),('422004'),('422005'),('422005'),('184013'),('184013'),('184013'),('805001'),('805002'),('805003'),('805004'),('805005'),('056024'),('056024'),('056024'),('423001'),('344010'),('235009'),('235009'),('235009'),('235009'),('212014'),('212014'),('056025'),('056025'),('056025'),('056026'),('056026'),('056026'),('056026'),('056026'),('056026'),('244034'),('244034'),('244034'),('244034'),('244034'),('244034'),('244035'),('244035'),('244035'),('244035'),('244035'),('244035'),('244035'),('244036'),('244036'),('244036'),('244036'),('244036'),('244036'),('244036'),('244037'),('244037'),('244037'),('244037'),('244037'),('244037'),('244037'),('244038'),('244038'),('244038'),('244038'),('244038'),('244038'),('244038'),('244039'),('244039'),('244039'),('244039'),('244039'),('244039'),('244039'),('203015'),('245002'),('245002'),('245001'),('245001'),('056029'),('056030'),('056032'),('424001'),('056034'),('056034'),('056034'),('056034'),('056033'),('056033'),('056033'),('805006'),('805007'),('805008'),('805009'),('805010'),('422008'),('422008'),('422007'),('422007'),('422006'),('422006'),('422010'),('422009'),('422009'),('422011'),('422011'),('209004'),('209004'),('150022'),('100002'),('056035'),('056035'),('056035'),('023036'),('023036'),('185005'),('246001'),('246001'),('247001'),('247001'),('247001'),('247001'),('247001'),('247001'),('247001'),('247002'),('247002'),('425001'),('416006'),('416006'),('165042'),('165041'),('165040'),('165043'),('010040'),('010039'),('010038'),('010036'),('248001'),('248002'),('248003'),('248004'),('248005'),('249001'),('249003'),('249004'),('249005'),('250007'),('250001'),('250002'),('250003'),('250004'),('250005'),('250006'),('250008'),('250009'),('250010'),('250011'),('250012'),('250013'),('251001'),('251002'),('806001'),('806002'),('235010'),('243009'),('249007'),('249008'),('249009'),('011024'),('011025'),('429001'),('429001'),('429002'),('429002'),('429003'),('429003');
+select field from t1 group by field;
+drop table t1;
diff --git a/mysql-test/t/type_float.test b/mysql-test/t/type_float.test
new file mode 100644
index 00000000000..7817dc3628a
--- /dev/null
+++ b/mysql-test/t/type_float.test
@@ -0,0 +1,48 @@
+# Description
+# -----------
+# Numeric floating point.
+
+SELECT 10,10.0,10.,.1e+2,100.0e-1;
+select 6e-05, -6e-05, --6e-05, -6e-05+1.000000;
+
+drop table if exists t1;
+create table t1 (f1 float(24),f2 float(52));
+show columns from t1;
+insert into t1 values(10,10),(1e+5,1e+5),(1234567890,1234567890),(1e+10,1e+10),(1e+15,1e+15),(1e+20,1e+20),(1e+50,1e+50),(1e+150,1e+150);
+insert into t1 values(-10,-10),(1e-5,1e-5),(1e-10,1e-10),(1e-15,1e-15),(1e-20,1e-20),(1e-50,1e-50),(1e-150,1e-150);
+select * from t1;
+drop table t1;
+
+create table t1 (datum double);
+insert into t1 values (0.5),(1.0),(1.5),(2.0),(2.5);
+select * from t1;
+select * from t1 where datum < 1.5;
+select * from t1 where datum > 1.5;
+select * from t1 where datum = 1.5;
+drop table t1;
+
+create table t1 (a decimal(7,3) not null, key (a));
+insert into t1 values ("0"),("-0.00"),("-0.01"),("-0.002"),("1");
+select a from t1 order by a;
+select min(a) from t1;
+drop table t1;
+
+#
+# FLOAT/DOUBLE/DECIMAL handling
+#
+
+create table t1 (f float, f2 float(24), f3 float(6,2), d double, d2 float(53), d3 double(10,3), de decimal, de2 decimal(6), de3 decimal(5,2), n numeric, n2 numeric(8), n3 numeric(5,6));
+show columns from t1;
+drop table t1;
+
+create table t1 (a decimal(7,3) not null, key (a));
+insert into t1 values ("0"),("-0.00"),("-0.01"),("-0.002"),("1");
+select a from t1 order by a;
+select min(a) from t1;
+drop table t1;
+
+# Errors
+
+!$1063 create table t1 (f float(54)); # Should give an error
+drop table if exists t1;
+
diff --git a/mysql-test/t/type_ranges.test b/mysql-test/t/type_ranges.test
new file mode 100644
index 00000000000..84e6183c367
--- /dev/null
+++ b/mysql-test/t/type_ranges.test
@@ -0,0 +1,154 @@
+#
+# Test ranges for all types and some other basic tests
+#
+
+drop table if exists t1,t2,t3;
+
+CREATE TABLE t1 (
+ auto int(5) unsigned DEFAULT 0 NOT NULL auto_increment,
+ string char(10) default "hello",
+ tiny tinyint(4) DEFAULT '0' NOT NULL ,
+ short smallint(6) DEFAULT '1' NOT NULL ,
+ medium mediumint(8) DEFAULT '0' NOT NULL,
+ long_int int(11) DEFAULT '0' NOT NULL,
+ longlong bigint(13) DEFAULT '0' NOT NULL,
+ real_float float(13,1) DEFAULT 0.0 NOT NULL,
+ real_double double(16,4),
+ utiny tinyint(3) unsigned DEFAULT '0' NOT NULL,
+ ushort smallint(5) unsigned zerofill DEFAULT '00000' NOT NULL,
+ umedium mediumint(8) unsigned DEFAULT '0' NOT NULL,
+ ulong int(11) unsigned DEFAULT '0' NOT NULL,
+ ulonglong bigint(13) unsigned DEFAULT '0' NOT NULL,
+ time_stamp timestamp,
+ date_field date,
+ time_field time,
+ date_time datetime,
+ blob_col blob,
+ tinyblob_col tinyblob,
+ mediumblob_col mediumblob not null,
+ longblob_col longblob not null,
+ options enum('one','two','tree') not null,
+ flags set('one','two','tree') not null,
+ PRIMARY KEY (auto),
+ KEY (utiny),
+ KEY (tiny),
+ KEY (short),
+ KEY any_name (medium),
+ KEY (longlong),
+ KEY (real_float),
+ KEY (ushort),
+ KEY (umedium),
+ KEY (ulong),
+ KEY (ulonglong,ulong),
+ KEY (options,flags)
+);
+
+show fields from t1;
+show keys from t1;
+
+CREATE UNIQUE INDEX test on t1 ( auto ) ;
+CREATE INDEX test2 on t1 ( ulonglong,ulong) ;
+CREATE INDEX test3 on t1 ( medium ) ;
+DROP INDEX test ON t1;
+
+insert into t1 values (10, 1,1,1,1,1,1,1,1,1,1,1,1,1,NULL,0,0,0,1,1,1,1,'one','one');
+insert into t1 values (NULL,2,2,2,2,2,2,2,2,2,2,2,2,2,NULL,NULL,NULL,NULL,NULL,NULL,2,2,'two','two,one');
+insert into t1 values (0,1/3,3,3,3,3,3,3,3,3,3,3,3,3,NULL,'19970303','10:10:10','19970303 101010','','','','3',3,3);
+insert into t1 values (0,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,NULL,19970807,080706,19970403090807,-1,-1,-1,'-1',-1,-1);
+insert into t1 values (0,-4294967295,-4294967295,-4294967295,-4294967295,-4294967295,-4294967295,-4294967295,-4294967295,-4294967295,-4294967295,-4294967295,-4294967295,-4294967295,NULL,0,0,0,-4294967295,-4294967295,-4294967295,'-4294967295',0,"one,two,tree");
+insert into t1 values (0,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,NULL,0,0,0,4294967295,4294967295,4294967295,'4294967295',0,0);
+insert into t1 (tiny) values (1);
+
+select auto,string,tiny,short,medium,long_int,longlong,real_float,real_double,utiny,ushort,umedium,ulong,ulonglong,mod(floor(time_stamp/1000000),1000000)-mod(curdate(),1000000),date_field,time_field,date_time,blob_col,tinyblob_col,mediumblob_col,longblob_col from t1;
+
+
+ALTER TABLE t1
+add new_field char(10) default "new" not null,
+change blob_col new_blob_col varchar(20),
+change date_field date_field char(10),
+alter column string set default "new default",
+alter short drop default,
+DROP INDEX utiny,
+DROP INDEX ushort,
+DROP PRIMARY KEY,
+DROP FOREIGN KEY any_name,
+ADD INDEX (auto);
+
+LOCK TABLES t1 WRITE;
+ALTER TABLE t1
+RENAME as t2,
+DROP longblob_col;
+UNLOCK TABLES;
+
+ALTER TABLE t2 rename as t3;
+LOCK TABLES t3 WRITE ;
+ALTER TABLE t3 rename as t1;
+UNLOCK TABLES;
+
+select auto,new_field,new_blob_col,date_field from t1 ;
+
+#
+# check with old syntax
+#
+CREATE TABLE t2 (
+ auto int(5) unsigned NOT NULL DEFAULT 0 auto_increment,
+ string char(20),
+ mediumblob_col mediumblob not null,
+ new_field char(2),
+ PRIMARY KEY (auto)
+);
+
+INSERT INTO t2 (string,mediumblob_col,new_field) SELECT string,mediumblob_col,new_field from t1 where auto > 10;
+
+select * from t2;
+
+# test enums
+select distinct flags from t1;
+select flags from t1 where find_in_set("two",flags)>0;
+select flags from t1 where find_in_set("unknown",flags)>0;
+select options,flags from t1 where options="ONE" and flags="ONE";
+select options,flags from t1 where options="one" and flags="one";
+
+drop table t2;
+
+#
+# Check CREATE ... SELECT
+#
+
+create table t2 select * from t1;
+update t2 set string="changed" where auto=16;
+show columns from t1;
+show columns from t2;
+select t1.auto,t2.auto from t1,t2 where t1.auto=t2.auto and ((t1.string<>t2.string and (t1.string is not null or t2.string is not null)) or (t1.tiny<>t2.tiny and (t1.tiny is not null or t2.tiny is not null)) or (t1.short<>t2.short and (t1.short is not null or t2.short is not null)) or (t1.medium<>t2.medium and (t1.medium is not null or t2.medium is not null)) or (t1.long_int<>t2.long_int and (t1.long_int is not null or t2.long_int is not null)) or (t1.longlong<>t2.longlong and (t1.longlong is not null or t2.longlong is not null)) or (t1.real_float<>t2.real_float and (t1.real_float is not null or t2.real_float is not null)) or (t1.real_double<>t2.real_double and (t1.real_double is not null or t2.real_double is not null)) or (t1.utiny<>t2.utiny and (t1.utiny is not null or t2.utiny is not null)) or (t1.ushort<>t2.ushort and (t1.ushort is not null or t2.ushort is not null)) or (t1.umedium<>t2.umedium and (t1.umedium is not null or t2.umedium is not null)) or (t1.ulong<>t2.ulong and (t1.ulong is not null or t2.ulong is not null)) or (t1.ulonglong<>t2.ulonglong and (t1.ulonglong is not null or t2.ulonglong is not null)) or (t1.time_stamp<>t2.time_stamp and (t1.time_stamp is not null or t2.time_stamp is not null)) or (t1.date_field<>t2.date_field and (t1.date_field is not null or t2.date_field is not null)) or (t1.time_field<>t2.time_field and (t1.time_field is not null or t2.time_field is not null)) or (t1.date_time<>t2.date_time and (t1.date_time is not null or t2.date_time is not null)) or (t1.new_blob_col<>t2.new_blob_col and (t1.new_blob_col is not null or t2.new_blob_col is not null)) or (t1.tinyblob_col<>t2.tinyblob_col and (t1.tinyblob_col is not null or t2.tinyblob_col is not null)) or (t1.mediumblob_col<>t2.mediumblob_col and (t1.mediumblob_col is not null or t2.mediumblob_col is not null)) or (t1.options<>t2.options and (t1.options is not null or t2.options is not null)) or (t1.flags<>t2.flags and (t1.flags is not null or t2.flags is not null)) or (t1.new_field<>t2.new_field and (t1.new_field is not null or t2.new_field is not null)));
+select t1.auto,t2.auto from t1,t2 where t1.auto=t2.auto and not (t1.string<=>t2.string and t1.tiny<=>t2.tiny and t1.short<=>t2.short and t1.medium<=>t2.medium and t1.long_int<=>t2.long_int and t1.longlong<=>t2.longlong and t1.real_float<=>t2.real_float and t1.real_double<=>t2.real_double and t1.utiny<=>t2.utiny and t1.ushort<=>t2.ushort and t1.umedium<=>t2.umedium and t1.ulong<=>t2.ulong and t1.ulonglong<=>t2.ulonglong and t1.time_stamp<=>t2.time_stamp and t1.date_field<=>t2.date_field and t1.time_field<=>t2.time_field and t1.date_time<=>t2.date_time and t1.new_blob_col<=>t2.new_blob_col and t1.tinyblob_col<=>t2.tinyblob_col and t1.mediumblob_col<=>t2.mediumblob_col and t1.options<=>t2.options and t1.flags<=>t2.flags and t1.new_field<=>t2.new_field);
+
+drop table t2;
+
+create table t2 (primary key (auto)) select auto+1 as auto,1 as t1, "a" as t2, repeat("a",256) as t3, binary repeat("b",256) as t4 from t1;
+show columns from t2;
+select * from t2;
+drop table t1,t2;
+
+create table t1 (c int);
+insert into t1 values(1),(2);
+create table t2 select * from t1;
+!$1060 create table t3 select * from t1, t2; # Should give an error
+create table t3 select t1.c AS c1, t2.c AS c2,1 as "const" from t1, t2;
+show columns from t3;
+drop table t1,t2,t3;
+
+create table t1 ( myfield INT NOT NULL, UNIQUE INDEX (myfield), unique (myfield), index(myfield));
+drop table t1;
+
+create table t1 ( id integer unsigned not null primary key );
+create table t2 ( id integer unsigned not null primary key );
+insert into t1 values (1), (2);
+insert into t2 values (1);
+select t1.id as id_A, t2.id as id_B from t1 left join t2 using ( id );
+create table t3 (id_A integer unsigned not null, id_B integer unsigned null );
+insert into t3 select t1.id as id_A, t2.id as id_B from t1 left join t2 using ( id );
+select * from t3;
+drop table t3;
+create table t3 select t1.id as id_A, t2.id as id_B from t1 left join t2 using ( id );
+select * from t3;
+drop table t1,t2,t3;
diff --git a/mysql-test/t/type_time.test b/mysql-test/t/type_time.test
new file mode 100644
index 00000000000..fde93576510
--- /dev/null
+++ b/mysql-test/t/type_time.test
@@ -0,0 +1,17 @@
+#
+# testing of the TIME column type
+#
+create table t1 (t time);
+insert into t1 values("10:22:33"),("12:34:56.78"),(10),(1234),(123456.78),(1234559.99),("1"),("1:23"),("1:23:45"), ("10.22"), ("-10 1:22:33.45"),("20 10:22:33"),("1999-02-03 20:33:34");
+insert t1 values (30),(1230),("1230"),("12:30"),("12:30:35"),("1 12:30:31.32");
+select * from t1;
+# Test wrong values
+insert into t1 values("10.22.22"),(1234567),(123456789),(123456789.10),("10 22:22"),("12.45a");
+select * from t1;
+drop table t1;
+
+create table t1 (t time);
+insert into t1 values ('09:00:00'),('13:00:00'),('19:38:34'), ('13:00:00'),('09:00:00'),('09:00:00'),('13:00:00'),('13:00:00'),('13:00:00'),('09:00:00');
+select t, time_to_sec(t),sec_to_time(time_to_sec(t)) from t1;
+select sec_to_time(time_to_sec(t)) from t1;
+drop table t1;
diff --git a/mysql-test/t/type_timestamp.test b/mysql-test/t/type_timestamp.test
new file mode 100644
index 00000000000..92ce87068da
--- /dev/null
+++ b/mysql-test/t/type_timestamp.test
@@ -0,0 +1,9 @@
+#
+# Test timestamp
+#
+
+CREATE TABLE t1 ( t timestamp);
+SET TIMESTAMP=1234;
+insert into t1 values(NULL);
+select * from t1;
+drop table t1;
diff --git a/mysql-test/t/type_uint.test b/mysql-test/t/type_uint.test
new file mode 100644
index 00000000000..32bcd61ecdb
--- /dev/null
+++ b/mysql-test/t/type_uint.test
@@ -0,0 +1,10 @@
+#
+# test of unsigned int
+#
+
+drop table if exists t1;
+create table t1 (this int unsigned);
+insert into t1 values (1);
+insert into t1 values (-1);
+select * from t1;
+drop table t1;
diff --git a/mysql-test/t/type_year.test b/mysql-test/t/type_year.test
new file mode 100644
index 00000000000..70a3053f19b
--- /dev/null
+++ b/mysql-test/t/type_year.test
@@ -0,0 +1,10 @@
+#
+# Test year
+#
+
+create table t1 (y year,y2 year(2));
+insert into t1 values (0,0),(1999,1999),(2000,2000),(2001,2001),(70,70),(69,69);
+select * from t1;
+select * from t1 order by y;
+select * from t1 order by y2;
+drop table t1;
diff --git a/mysql-test/t/update.test b/mysql-test/t/update.test
new file mode 100644
index 00000000000..6010c311015
--- /dev/null
+++ b/mysql-test/t/update.test
@@ -0,0 +1,29 @@
+#
+# test of updating of keys
+#
+
+drop table if exists t1;
+create table t1 (a int auto_increment , primary key (a));
+insert into t1 values (NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL);
+update t1 set a=a+10 where a > 34;
+update t1 set a=a+100 where a > 0;
+drop table t1;
+
+CREATE TABLE t1
+ (
+ place_id int (10) unsigned NOT NULL,
+ shows int(10) unsigned DEFAULT '0' NOT NULL,
+ ishows int(10) unsigned DEFAULT '0' NOT NULL,
+ ushows int(10) unsigned DEFAULT '0' NOT NULL,
+ clicks int(10) unsigned DEFAULT '0' NOT NULL,
+ iclicks int(10) unsigned DEFAULT '0' NOT NULL,
+ uclicks int(10) unsigned DEFAULT '0' NOT NULL,
+ ts timestamp(14),
+ PRIMARY KEY (place_id,ts)
+ );
+
+INSERT INTO t1 (place_id,shows,ishows,ushows,clicks,iclicks,uclicks,ts)
+VALUES (1,0,0,0,0,0,0,20000928174434);
+UPDATE t1 SET shows=shows+1,ishows=ishows+1,ushows=ushows+1,clicks=clicks+1,iclicks=iclicks+1,uclicks=uclicks+1 WHERE place_id=1 AND ts>="2000-09-28 00:00:00";
+select place_id,shows from t1;
+drop table t1;
diff --git a/mysql-test/t/varbinary.test b/mysql-test/t/varbinary.test
new file mode 100644
index 00000000000..0ab26f51e65
--- /dev/null
+++ b/mysql-test/t/varbinary.test
@@ -0,0 +1,16 @@
+#
+# varbinary as string and number
+#
+
+select 0x41,0x41+0,0x41 | 0x7fffffffffffffff | 0,0xffffffffffffffff | 0 ;
+select 0x31+1,concat(0x31)+1,-0xf;
+
+#
+# Test of hex constants in WHERE:
+#
+
+create table t1 (ID int(8) unsigned zerofill not null auto_increment,UNIQ bigint(21) unsigned zerofill not null,primary key (ID),unique (UNIQ) );
+insert into t1 set UNIQ=0x38afba1d73e6a18a;
+insert into t1 set UNIQ=123;
+explain select * from t1 where UNIQ=0x38afba1d73e6a18a;
+drop table t1;
diff --git a/mysql-test/t/variables.test b/mysql-test/t/variables.test
new file mode 100644
index 00000000000..1067559b759
--- /dev/null
+++ b/mysql-test/t/variables.test
@@ -0,0 +1,14 @@
+#
+# test variables
+#
+set @`test`=1,@TEST=3,@select=2;
+select @test,@`select`,@TEST,@not_used;
+set @test_int=10,@test_double=1e-10,@test_string="abcdeghi",@test_string2="abcdefghij",@select=NULL;
+select @test_int,@test_double,@test_string,@test_string2,@select;
+set @test_int="hello",@test_double="hello",@test_string="hello",@test_string2="hello";
+select @test_int,@test_double,@test_string,@test_string2;
+set @test_int="hellohello",@test_double="hellohello",@test_string="hellohello",@test_string2="hellohello";
+select @test_int,@test_double,@test_string,@test_string2;
+set @test_int=null,@test_double=null,@test_string=null,@test_string2=null;
+select @test_int,@test_double,@test_string,@test_string2;
+select @t1:=(@t2:=1)+@t3:=4,@t1,@t2,@t3;
diff --git a/mysql-test/t/warnings.test b/mysql-test/t/warnings.test
new file mode 100644
index 00000000000..e7cb1f46ec3
--- /dev/null
+++ b/mysql-test/t/warnings.test
@@ -0,0 +1,13 @@
+#
+# Test some warnings
+#
+
+create table t1 (a int);
+insert into t1 values (1);
+insert into t1 values ("hej");
+insert into t1 values ("hej"),("då");
+set SQL_WARNINGS=1;
+insert into t1 values ("hej");
+insert into t1 values ("hej"),("då");
+drop table t1;
+set SQL_WARNINGS=0;
diff --git a/mysys/hash.c b/mysys/hash.c
index 9c6497c7717..b366554272a 100644
--- a/mysys/hash.c
+++ b/mysys/hash.c
@@ -108,6 +108,8 @@ static uint hash_rec_mask(HASH *hash,HASH_LINK *pos,uint buffmax,
return hash_mask((*hash->calc_hashnr)(key,length),buffmax,maxlength);
}
+#ifndef NEW_HASH_FUNCTION
+
/* Calc hashvalue for a key */
static uint calc_hashnr(const byte *key,uint length)
@@ -134,6 +136,49 @@ static uint calc_hashnr_caseup(const byte *key,uint length)
return((uint) nr);
}
+#else
+
+/*
+ * Fowler/Noll/Vo hash
+ *
+ * The basis of the hash algorithm was taken from an idea sent by email to the
+ * IEEE Posix P1003.2 mailing list from Phong Vo (kpv@research.att.com) and
+ * Glenn Fowler (gsf@research.att.com). Landon Curt Noll (chongo@toad.com)
+ * later improved on their algorithm.
+ *
+ * The magic is in the interesting relationship between the special prime
+ * 16777619 (2^24 + 403) and 2^32 and 2^8.
+ *
+ * This hash produces the fewest collisions of any function that we've seen so
+ * far, and works well on both numbers and strings.
+ */
+
+uint calc_hashnr(const byte *key, uint len)
+{
+ const byte *end=key+len;
+ uint hash;
+ for (hash = 0; key < end; key++)
+ {
+ hash *= 16777619;
+ hash ^= (uint) *(uchar*) key;
+ }
+ return (hash);
+}
+
+uint calc_hashnr_caseup(const byte *key, uint len)
+{
+ const byte *end=key+len;
+ uint hash;
+ for (hash = 0; key < end; key++)
+ {
+ hash *= 16777619;
+ hash ^= (uint) (uchar) toupper(*key);
+ }
+ return (hash);
+}
+
+#endif
+
static inline uint rec_hashnr(HASH *hash,const byte *record)
{
diff --git a/scripts/mysqld_multi.sh b/scripts/mysqld_multi.sh
index 8d22129d850..1adaa458271 100644
--- a/scripts/mysqld_multi.sh
+++ b/scripts/mysqld_multi.sh
@@ -10,7 +10,7 @@ $opt_config_file = undef();
$opt_example = 0;
$opt_help = 0;
$opt_log = "/tmp/mysqld_multi.log";
-$opt_mysqladmin = "mysqladmin";
+$opt_mysqladmin = "@bindir@/mysqladmin";
$opt_mysqld = "@libexecdir@/mysqld";
$opt_no_log = 0;
$opt_password = undef();
diff --git a/scripts/safe_mysqld.sh b/scripts/safe_mysqld.sh
index 9325cee4f33..11d17f822ee 100644
--- a/scripts/safe_mysqld.sh
+++ b/scripts/safe_mysqld.sh
@@ -51,6 +51,7 @@ parse_arguments() {
--open-files-limit=*) open_files=`echo "$arg" | sed -e "s;--open-files-limit=;;"` ;;
--core-file-size=*) core_file_size=`echo "$arg" | sed -e "s;--core_file_size=;;"` ;;
--timezone=*) TZ=`echo "$arg" | sed -e "s;--timezone=;;"` ; export TZ; ;;
+ --mysqld=*) MYSQLD=`echo "$arg" | sed -e "s;--mysqld=;;"` ;;
*)
if test -n "$pick_args"
then
@@ -87,6 +88,7 @@ fi
MYSQL_UNIX_PORT=${MYSQL_UNIX_PORT:-@MYSQL_UNIX_ADDR@}
MYSQL_TCP_PORT=${MYSQL_TCP_PORT:-@MYSQL_TCP_PORT@}
user=@MYSQLD_USER@
+MYSQLD=mysqld
# these rely on $DATADIR by default, so we'll set them later on
pid_file=
@@ -111,9 +113,9 @@ args=
parse_arguments `$print_defaults $defaults mysqld safe_mysqld`
parse_arguments PICK-ARGS-FROM-ARGV "$@"
-if test ! -x $ledir/mysqld
+if test ! -x $ledir/$MYSQLD
then
- echo "The file $ledir/mysqld doesn't exist or is not executable"
+ echo "The file $ledir/$MYSQLD doesn't exist or is not executable"
echo "Please do a cd to the mysql installation directory and restart"
echo "this script from there as follows:"
echo "./bin/safe_mysqld".
@@ -195,7 +197,7 @@ fi
# $MY_BASEDIR_VERSION/bin/myisamchk --silent --force --fast --medium-check -O key_buffer=64M -O sort_buffer=64M $DATADIR/*/*.MYI
# $MY_BASEDIR_VERSION/bin/isamchk --silent --force -O sort_buffer=64M $DATADIR/*/*.ISM
-echo "Starting mysqld daemon with databases from $DATADIR"
+echo "Starting $MYSQLD daemon with databases from $DATADIR"
# Does this work on all systems?
#if type ulimit | grep "shell builtin" > /dev/null
@@ -209,9 +211,9 @@ do
rm -f $MYSQL_UNIX_PORT $pid_file # Some extra safety
if test -z "$args"
then
- $NOHUP_NICENESS $ledir/mysqld $defaults --basedir=$MY_BASEDIR_VERSION --datadir=$DATADIR --user=$user --pid-file=$pid_file @MYSQLD_DEFAULT_SWITCHES@ >> $err_log 2>&1
+ $NOHUP_NICENESS $ledir/$MYSQLD $defaults --basedir=$MY_BASEDIR_VERSION --datadir=$DATADIR --user=$user --pid-file=$pid_file @MYSQLD_DEFAULT_SWITCHES@ >> $err_log 2>&1
else
- eval "$NOHUP_NICENESS $ledir/mysqld $defaults --basedir=$MY_BASEDIR_VERSION --datadir=$DATADIR --user=$user --pid-file=$pid_file @MYSQLD_DEFAULT_SWITCHES@ $args >> $err_log 2>&1"
+ eval "$NOHUP_NICENESS $ledir/$MYSQLD $defaults --basedir=$MY_BASEDIR_VERSION --datadir=$DATADIR --user=$user --pid-file=$pid_file @MYSQLD_DEFAULT_SWITCHES@ $args >> $err_log 2>&1"
fi
if test ! -f $pid_file # This is removed if normal shutdown
then
@@ -225,12 +227,12 @@ do
# but should work for the rest of the servers.
# The only thing is ps x => redhat 5 gives warnings when using ps -x.
# kill -9 is used or the process won't react on the kill.
- numofproces=`ps xa | grep -v "grep" | grep -c $ledir/mysqld`
+ numofproces=`ps xa | grep -v "grep" | grep -c $ledir/$MYSQLD`
echo -e "\nNumber of processes running now: $numofproces" | tee -a $err_log
I=1
while test "$I" -le "$numofproces"
do
- PROC=`ps xa | grep $ledir/mysqld | grep -v "grep" | tail -1`
+ PROC=`ps xa | grep $ledir/$MYSQLD | grep -v "grep" | tail -1`
for T in $PROC
do
break
@@ -238,7 +240,7 @@ do
# echo "TEST $I - $T **"
if kill -9 $T
then
- echo "mysqld process hanging, pid $T - killed" | tee -a $err_log
+ echo "$MYSQLD process hanging, pid $T - killed" | tee -a $err_log
else
break
fi
diff --git a/sql-bench/Results/ATIS-mysql-Linux_2.2.13_SMP_alpha b/sql-bench/Results/ATIS-mysql-Linux_2.2.13_SMP_alpha
index 9f9c00dbc4f..e411b45a056 100644
--- a/sql-bench/Results/ATIS-mysql-Linux_2.2.13_SMP_alpha
+++ b/sql-bench/Results/ATIS-mysql-Linux_2.2.13_SMP_alpha
@@ -1,4 +1,4 @@
-Testing server 'MySQL 3.23.29 gamma' at 2000-11-28 17:24:55
+Testing server 'MySQL 3.23.30 gamma' at 2000-12-28 15:29:27
ATIS table test
@@ -6,14 +6,15 @@ Creating tables
Time for create_table (28): 0 wallclock secs ( 0.00 usr 0.00 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Inserting data
-Time to insert (9768): 4 wallclock secs ( 0.64 usr 0.64 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
+Time to insert (9768): 3 wallclock secs ( 0.64 usr 0.61 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Retrieving data
-Time for select_simple_join (500): 1 wallclock secs ( 0.66 usr 0.38 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
-Time for select_join (200): 12 wallclock secs ( 4.45 usr 3.14 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
-Time for select_distinct (800): 11 wallclock secs ( 1.77 usr 0.97 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
-Time for select_group (2800): 10 wallclock secs ( 1.59 usr 0.65 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
+Time for select_simple_join (500): 2 wallclock secs ( 0.62 usr 0.39 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
+Time for select_join (100): 2 wallclock secs ( 0.47 usr 0.35 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
+Time for select_key_prefix_join (100): 10 wallclock secs ( 3.80 usr 2.75 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
+Time for select_distinct (800): 11 wallclock secs ( 1.63 usr 1.04 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
+Time for select_group (2800): 10 wallclock secs ( 1.48 usr 0.66 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Removing tables
Time to drop_table (28): 0 wallclock secs ( 0.00 usr 0.00 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
-Total time: 38 wallclock secs ( 9.13 usr 5.79 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
+Total time: 38 wallclock secs ( 8.65 usr 5.80 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
diff --git a/sql-bench/Results/RUN-mysql-Linux_2.2.13_SMP_alpha b/sql-bench/Results/RUN-mysql-Linux_2.2.13_SMP_alpha
index 69853f363bc..0c65cbaaf16 100644
--- a/sql-bench/Results/RUN-mysql-Linux_2.2.13_SMP_alpha
+++ b/sql-bench/Results/RUN-mysql-Linux_2.2.13_SMP_alpha
@@ -1,92 +1,95 @@
-Benchmark DBD suite: 2.10
-Date of test: 2000-11-28 17:24:55
+Benchmark DBD suite: 2.11
+Date of test: 2000-12-28 17:09:41
Running tests on: Linux 2.2.13-SMP alpha
Arguments:
-Comments: Alpha DS20 2x500 MHz, 2G memory, key_buffer=16M; gcc 2.95.2 + ccc
+Comments: Alpha DS20 2x500 MHz, 2G memory, key_buffer=16M; cxx 6.3 + ccc 6.2.9
Limits from:
-Server version: MySQL 3.23.29 gamma
+Server version: MySQL 3.23.30 gamma
-ATIS: Total time: 38 wallclock secs ( 9.13 usr 5.79 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
-alter-table: Total time: 391 wallclock secs ( 0.31 usr 0.17 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
-big-tables: Total time: 41 wallclock secs ( 8.35 usr 10.24 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
-connect: Total time: 76 wallclock secs (31.66 usr 19.05 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
-create: Total time: 133 wallclock secs (10.24 usr 4.48 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
-insert: Total time: 1821 wallclock secs (430.65 usr 226.65 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
-select: Total time: 1170 wallclock secs (57.76 usr 27.85 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
-wisconsin: Total time: 18 wallclock secs ( 3.70 usr 2.82 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
+ATIS: Total time: 38 wallclock secs ( 8.65 usr 5.80 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
+alter-table: Total time: 396 wallclock secs ( 0.30 usr 0.17 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
+big-tables: Total time: 41 wallclock secs ( 8.30 usr 10.73 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
+connect: Total time: 74 wallclock secs (32.31 usr 18.97 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
+create: Total time: 207 wallclock secs (10.36 usr 4.42 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
+insert: Total time: 1932 wallclock secs (465.91 usr 251.37 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
+select: Total time: 1127 wallclock secs (61.16 usr 29.24 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
+wisconsin: Total time: 18 wallclock secs ( 3.58 usr 2.86 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
All 8 test executed successfully
Totals per operation:
Operation seconds usr sys cpu tests
-alter_table_add 213.00 0.17 0.07 0.00 992
-alter_table_drop 170.00 0.07 0.03 0.00 496
-connect 14.00 7.49 2.43 0.00 10000
-connect+select_1_row 17.00 7.59 3.33 0.00 10000
-connect+select_simple 15.00 7.61 3.24 0.00 10000
-count 48.00 0.03 0.01 0.00 100
-count_distinct 92.00 0.69 0.21 0.00 2000
-count_distinct_big 135.00 7.24 8.53 0.00 120
-count_distinct_group 64.00 1.06 0.66 0.00 1000
-count_distinct_group_on_key 42.00 0.43 0.14 0.00 1000
-count_distinct_group_on_key_parts 63.00 1.10 0.62 0.00 1000
-count_group_on_key_parts 40.00 1.00 0.61 0.00 1000
-count_on_key 428.00 15.76 4.53 0.00 50100
-create+drop 13.00 2.68 1.04 0.00 10000
-create_MANY_tables 90.00 1.79 0.64 0.00 10000
+alter_table_add 213.00 0.17 0.06 0.00 992
+alter_table_drop 175.00 0.06 0.04 0.00 496
+connect 13.00 7.51 2.43 0.00 10000
+connect+select_1_row 17.00 7.95 3.44 0.00 10000
+connect+select_simple 16.00 7.69 3.23 0.00 10000
+count 50.00 0.04 0.01 0.00 100
+count_distinct 102.00 0.71 0.21 0.00 2000
+count_distinct_big 133.00 8.01 9.25 0.00 120
+count_distinct_group 63.00 1.16 0.69 0.00 1000
+count_distinct_group_on_key 42.00 0.45 0.16 0.00 1000
+count_distinct_group_on_key_parts 62.00 1.20 0.66 0.00 1000
+count_group_on_key_parts 38.00 1.16 0.66 0.00 1000
+count_on_key 395.00 16.46 4.54 0.00 50100
+create+drop 13.00 2.77 1.02 0.00 10000
+create_MANY_tables 164.00 1.93 0.57 0.00 10000
create_index 4.00 0.00 0.00 0.00 8
-create_key+drop 17.00 4.18 1.32 0.00 10000
+create_key+drop 17.00 4.14 1.36 0.00 10000
create_table 0.00 0.00 0.00 0.00 31
delete_all 11.00 0.00 0.00 0.00 12
-delete_all_many_keys 49.00 0.02 0.01 0.00 1
+delete_all_many_keys 50.00 0.01 0.01 0.00 1
delete_big 0.00 0.00 0.00 0.00 1
-delete_big_many_keys 49.00 0.02 0.01 0.00 128
-delete_key 4.00 0.66 0.53 0.00 10000
+delete_big_many_keys 50.00 0.01 0.01 0.00 128
+delete_key 5.00 0.60 0.53 0.00 10000
drop_index 4.00 0.00 0.00 0.00 8
drop_table 0.00 0.00 0.00 0.00 28
-drop_table_when_MANY_tables 7.00 0.62 0.61 0.00 10000
-insert 137.00 24.96 21.11 0.00 350768
-insert_duplicates 38.00 5.63 6.17 0.00 100000
-insert_key 94.00 7.67 5.66 0.00 100000
+drop_table_when_MANY_tables 7.00 0.68 0.64 0.00 10000
+insert 133.00 23.24 21.08 0.00 350768
+insert_duplicates 38.00 5.55 6.19 0.00 100000
+insert_key 96.00 8.23 5.98 0.00 100000
insert_many_fields 14.00 0.35 0.12 0.00 2000
-insert_select_1_key 5.00 0.00 0.00 0.00 1
+insert_select_1_key 6.00 0.00 0.00 0.00 1
insert_select_2_keys 6.00 0.00 0.00 0.00 1
-min_max 20.00 0.02 0.00 0.00 60
-min_max_on_key 175.00 25.68 7.59 0.00 85000
-multiple_value_insert 7.00 2.15 0.05 0.00 100000
-order_by_big 54.00 22.33 21.66 0.00 10
-order_by_big_key 36.00 21.23 14.75 0.00 10
-order_by_big_key2 37.00 21.94 15.04 0.00 10
-order_by_big_key_desc 37.00 21.53 14.74 0.00 10
-order_by_big_key_diff 51.00 22.21 21.67 0.00 10
-order_by_key 2.00 1.14 0.63 0.00 500
-order_by_key2_diff 5.00 1.99 1.23 0.00 500
-order_by_range 5.00 1.14 0.64 0.00 500
-outer_join 57.00 0.00 0.00 0.00 10
-outer_join_found 52.00 0.00 0.00 0.00 10
-outer_join_not_found 34.00 0.00 0.00 0.00 500
-outer_join_on_key 38.00 0.01 0.00 0.00 10
-select_1_row 2.00 0.35 0.95 0.00 10000
-select_2_rows 3.00 0.34 1.00 0.00 10000
-select_big 56.00 28.86 21.57 0.00 10080
-select_column+column 3.00 0.26 0.67 0.00 10000
-select_diff_key 148.00 0.21 0.05 0.00 500
-select_distinct 11.00 1.77 0.97 0.00 800
-select_group 49.00 1.63 0.66 0.00 2911
-select_group_when_MANY_tables 6.00 0.96 0.87 0.00 10000
-select_join 12.00 4.45 3.14 0.00 200
-select_key 137.00 73.10 21.05 0.00 200000
-select_key2 142.00 72.16 21.15 0.00 200000
-select_key_prefix 143.00 72.60 21.07 0.00 200000
-select_many_fields 26.00 7.99 10.11 0.00 2000
-select_range 229.00 8.56 5.62 0.00 410
-select_range_key2 19.00 6.47 2.33 0.00 25010
-select_range_prefix 20.00 6.51 2.25 0.00 25010
-select_simple 2.00 0.28 0.77 0.00 10000
-select_simple_join 1.00 0.66 0.38 0.00 500
-update_big 27.00 0.00 0.00 0.00 10
-update_of_key 48.00 3.45 3.04 0.00 50256
-update_of_key_big 18.00 0.04 0.03 0.00 501
-update_with_key 134.00 18.92 18.69 0.00 300000
-wisc_benchmark 4.00 1.88 0.93 0.00 114
-TOTALS 3733.00 551.64 296.93 0.00 1946237
+min_max 22.00 0.02 0.01 0.00 60
+min_max_on_key 162.00 26.32 7.66 0.00 85000
+multiple_value_insert 7.00 2.08 0.05 0.00 100000
+order_by_big 53.00 20.57 21.79 0.00 10
+order_by_big_key 38.00 22.77 15.36 0.00 10
+order_by_big_key2 35.00 19.87 14.91 0.00 10
+order_by_big_key_desc 38.00 22.72 15.24 0.00 10
+order_by_big_key_diff 49.00 20.43 21.94 0.00 10
+order_by_big_key_prefix 35.00 19.98 14.81 0.00 10
+order_by_key2_diff 5.00 1.81 1.27 0.00 500
+order_by_key_prefix 3.00 1.07 0.64 0.00 500
+order_by_range 4.00 1.09 0.62 0.00 500
+outer_join 60.00 0.00 0.00 0.00 10
+outer_join_found 56.00 0.00 0.00 0.00 10
+outer_join_not_found 37.00 0.00 0.00 0.00 500
+outer_join_on_key 44.00 0.00 0.00 0.00 10
+select_1_row 2.00 0.46 1.12 0.00 10000
+select_2_rows 3.00 0.36 1.00 0.00 10000
+select_big 56.00 28.42 21.18 0.00 10080
+select_column+column 3.00 0.28 0.76 0.00 10000
+select_diff_key 151.00 0.25 0.04 0.00 500
+select_distinct 11.00 1.63 1.04 0.00 800
+select_group 50.00 1.52 0.68 0.00 2911
+select_group_when_MANY_tables 6.00 0.84 0.83 0.00 10000
+select_join 2.00 0.47 0.35 0.00 100
+select_key 141.00 75.34 22.71 0.00 200000
+select_key2 146.00 75.75 22.08 0.00 200000
+select_key_prefix 147.00 76.05 21.66 0.00 200000
+select_key_prefix_join 10.00 3.80 2.75 0.00 100
+select_many_fields 26.00 7.94 10.60 0.00 2000
+select_range 227.00 9.67 5.91 0.00 410
+select_range_key2 19.00 6.72 2.30 0.00 25010
+select_range_prefix 19.00 6.65 2.24 0.00 25010
+select_simple 1.00 0.31 0.80 0.00 10000
+select_simple_join 2.00 0.62 0.39 0.00 500
+update_big 26.00 0.00 0.00 0.00 10
+update_of_key 48.00 3.60 3.12 0.00 50256
+update_of_key_big 19.00 0.04 0.03 0.00 501
+update_with_key 135.00 21.98 17.77 0.00 300000
+update_with_key_prefix 42.00 7.22 5.96 0.00 100000
+wisc_benchmark 4.00 1.71 0.98 0.00 114
+TOTALS 3881.00 590.44 323.49 0.00 2046247
diff --git a/sql-bench/Results/alter-table-mysql-Linux_2.2.13_SMP_alpha b/sql-bench/Results/alter-table-mysql-Linux_2.2.13_SMP_alpha
index 329f27b8acb..b2f9f2e537a 100644
--- a/sql-bench/Results/alter-table-mysql-Linux_2.2.13_SMP_alpha
+++ b/sql-bench/Results/alter-table-mysql-Linux_2.2.13_SMP_alpha
@@ -1,16 +1,16 @@
-Testing server 'MySQL 3.23.29 gamma' at 2000-11-28 17:25:34
+Testing server 'MySQL 3.23.30 gamma' at 2000-12-28 15:30:07
Testing of ALTER TABLE
Testing with 1000 columns and 1000 rows in 20 steps
Insert data into the table
Time for insert (1000) 0 wallclock secs ( 0.06 usr 0.06 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
-Time for alter_table_add (992): 213 wallclock secs ( 0.17 usr 0.07 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
+Time for alter_table_add (992): 213 wallclock secs ( 0.17 usr 0.06 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for create_index (8): 4 wallclock secs ( 0.00 usr 0.00 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for drop_index (8): 4 wallclock secs ( 0.00 usr 0.00 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
-Time for alter_table_drop (496): 170 wallclock secs ( 0.07 usr 0.03 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
+Time for alter_table_drop (496): 175 wallclock secs ( 0.06 usr 0.04 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
-Total time: 391 wallclock secs ( 0.31 usr 0.17 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
+Total time: 396 wallclock secs ( 0.30 usr 0.17 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
diff --git a/sql-bench/Results/big-tables-mysql-Linux_2.2.13_SMP_alpha b/sql-bench/Results/big-tables-mysql-Linux_2.2.13_SMP_alpha
index 073e2f2b4d2..0f2d03e3e7e 100644
--- a/sql-bench/Results/big-tables-mysql-Linux_2.2.13_SMP_alpha
+++ b/sql-bench/Results/big-tables-mysql-Linux_2.2.13_SMP_alpha
@@ -1,19 +1,19 @@
-Testing server 'MySQL 3.23.29 gamma' at 2000-11-28 17:32:05
+Testing server 'MySQL 3.23.30 gamma' at 2000-12-28 15:36:43
Testing of some unusual tables
All tests are done 1000 times with 1000 fields
Testing table with 1000 fields
Testing select * from table with 1 record
-Time to select_many_fields(1000): 10 wallclock secs ( 3.93 usr 5.07 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
+Time to select_many_fields(1000): 10 wallclock secs ( 3.89 usr 5.32 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Testing select all_fields from table with 1 record
-Time to select_many_fields(1000): 16 wallclock secs ( 4.06 usr 5.04 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
+Time to select_many_fields(1000): 16 wallclock secs ( 4.05 usr 5.28 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Testing insert VALUES()
-Time to insert_many_fields(1000): 5 wallclock secs ( 0.33 usr 0.07 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
+Time to insert_many_fields(1000): 5 wallclock secs ( 0.32 usr 0.07 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Testing insert (all_fields) VALUES()
-Time to insert_many_fields(1000): 9 wallclock secs ( 0.02 usr 0.05 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
+Time to insert_many_fields(1000): 9 wallclock secs ( 0.03 usr 0.05 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
-Total time: 41 wallclock secs ( 8.35 usr 10.24 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
+Total time: 41 wallclock secs ( 8.30 usr 10.73 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
diff --git a/sql-bench/Results/connect-mysql-Linux_2.2.13_SMP_alpha b/sql-bench/Results/connect-mysql-Linux_2.2.13_SMP_alpha
index 2704a8a38ff..bb435fe30ad 100644
--- a/sql-bench/Results/connect-mysql-Linux_2.2.13_SMP_alpha
+++ b/sql-bench/Results/connect-mysql-Linux_2.2.13_SMP_alpha
@@ -1,30 +1,30 @@
-Testing server 'MySQL 3.23.29 gamma' at 2000-11-28 17:32:46
+Testing server 'MySQL 3.23.30 gamma' at 2000-12-28 15:37:25
Testing the speed of connecting to the server and sending of data
All tests are done 10000 times
Testing connection/disconnect
-Time to connect (10000): 14 wallclock secs ( 7.49 usr 2.43 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
+Time to connect (10000): 13 wallclock secs ( 7.51 usr 2.43 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Test connect/simple select/disconnect
-Time for connect+select_simple (10000): 15 wallclock secs ( 7.61 usr 3.24 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
+Time for connect+select_simple (10000): 16 wallclock secs ( 7.69 usr 3.23 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Test simple select
-Time for select_simple (10000): 2 wallclock secs ( 0.28 usr 0.77 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
+Time for select_simple (10000): 1 wallclock secs ( 0.31 usr 0.80 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Testing connect/select 1 row from table/disconnect
-Time to connect+select_1_row (10000): 17 wallclock secs ( 7.59 usr 3.33 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
+Time to connect+select_1_row (10000): 17 wallclock secs ( 7.95 usr 3.44 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Testing select 1 row from table
-Time to select_1_row (10000): 2 wallclock secs ( 0.35 usr 0.95 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
+Time to select_1_row (10000): 2 wallclock secs ( 0.46 usr 1.12 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Testing select 2 rows from table
-Time to select_2_rows (10000): 3 wallclock secs ( 0.34 usr 1.00 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
+Time to select_2_rows (10000): 3 wallclock secs ( 0.36 usr 1.00 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Test select with aritmetic (+)
-Time for select_column+column (10000): 3 wallclock secs ( 0.26 usr 0.67 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
+Time for select_column+column (10000): 3 wallclock secs ( 0.28 usr 0.76 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Testing retrieval of big records (65000 bytes)
-Time to select_big (10000): 20 wallclock secs ( 7.74 usr 6.67 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
+Time to select_big (10000): 19 wallclock secs ( 7.75 usr 6.19 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
-Total time: 76 wallclock secs (31.66 usr 19.05 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
+Total time: 74 wallclock secs (32.31 usr 18.97 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
diff --git a/sql-bench/Results/create-mysql-Linux_2.2.13_SMP_alpha b/sql-bench/Results/create-mysql-Linux_2.2.13_SMP_alpha
index aeb309681f4..894ac19360c 100644
--- a/sql-bench/Results/create-mysql-Linux_2.2.13_SMP_alpha
+++ b/sql-bench/Results/create-mysql-Linux_2.2.13_SMP_alpha
@@ -1,18 +1,18 @@
-Testing server 'MySQL 3.23.29 gamma' at 2000-11-28 17:34:02
+Testing server 'MySQL 3.23.30 gamma' at 2000-12-28 15:38:39
Testing the speed of creating and droping tables
Testing with 10000 tables and 10000 loop count
Testing create of tables
-Time for create_MANY_tables (10000): 90 wallclock secs ( 1.79 usr 0.64 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
+Time for create_MANY_tables (10000): 164 wallclock secs ( 1.93 usr 0.57 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Accessing tables
-Time to select_group_when_MANY_tables (10000): 6 wallclock secs ( 0.96 usr 0.87 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
+Time to select_group_when_MANY_tables (10000): 6 wallclock secs ( 0.84 usr 0.83 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Testing drop
-Time for drop_table_when_MANY_tables (10000): 7 wallclock secs ( 0.62 usr 0.61 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
+Time for drop_table_when_MANY_tables (10000): 7 wallclock secs ( 0.68 usr 0.64 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Testing create+drop
-Time for create+drop (10000): 13 wallclock secs ( 2.68 usr 1.04 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
-Time for create_key+drop (10000): 17 wallclock secs ( 4.18 usr 1.32 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
-Total time: 133 wallclock secs (10.24 usr 4.48 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
+Time for create+drop (10000): 13 wallclock secs ( 2.77 usr 1.02 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
+Time for create_key+drop (10000): 17 wallclock secs ( 4.14 usr 1.36 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
+Total time: 207 wallclock secs (10.36 usr 4.42 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
diff --git a/sql-bench/Results/insert-mysql-Linux_2.2.13_SMP_alpha b/sql-bench/Results/insert-mysql-Linux_2.2.13_SMP_alpha
index e2dc57577bb..9bb8493333b 100644
--- a/sql-bench/Results/insert-mysql-Linux_2.2.13_SMP_alpha
+++ b/sql-bench/Results/insert-mysql-Linux_2.2.13_SMP_alpha
@@ -1,4 +1,4 @@
-Testing server 'MySQL 3.23.29 gamma' at 2000-11-28 17:36:15
+Testing server 'MySQL 3.23.30 gamma' at 2000-12-28 15:42:07
Testing the speed of inserting data into 1 table and do some selects on it.
The tests are done with a table that has 100000 rows.
@@ -8,78 +8,80 @@ Creating tables
Inserting 100000 rows in order
Inserting 100000 rows in reverse order
Inserting 100000 rows in random order
-Time for insert (300000): 115 wallclock secs (21.74 usr 18.00 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
+Time for insert (300000): 113 wallclock secs (20.01 usr 17.88 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Testing insert of duplicates
-Time for insert_duplicates (100000): 38 wallclock secs ( 5.63 usr 6.17 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
+Time for insert_duplicates (100000): 38 wallclock secs ( 5.55 usr 6.19 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Retrieving data from the table
-Time for select_big (10:3000000): 35 wallclock secs (20.98 usr 14.81 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
-Time for order_by_big_key (10:3000000): 36 wallclock secs (21.23 usr 14.75 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
-Time for order_by_big_key_desc (10:3000000): 37 wallclock secs (21.53 usr 14.74 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
-Time for order_by_big_key2 (10:3000000): 37 wallclock secs (21.94 usr 15.04 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
-Time for order_by_big_key_diff (10:3000000): 51 wallclock secs (22.21 usr 21.67 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
-Time for order_by_big (10:3000000): 54 wallclock secs (22.33 usr 21.66 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
-Time for order_by_range (500:125750): 5 wallclock secs ( 1.14 usr 0.64 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
-Time for order_by_key (500:125750): 2 wallclock secs ( 1.14 usr 0.63 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
-Time for order_by_key2_diff (500:250500): 5 wallclock secs ( 1.99 usr 1.23 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
-Time for select_diff_key (500:1000): 148 wallclock secs ( 0.21 usr 0.05 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
-Time for select_range_prefix (5010:42084): 11 wallclock secs ( 2.83 usr 0.97 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
-Time for select_range_key2 (5010:42084): 10 wallclock secs ( 2.80 usr 1.00 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
-Time for select_key_prefix (200000): 143 wallclock secs (72.60 usr 21.07 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
-Time for select_key (200000): 137 wallclock secs (73.10 usr 21.05 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
-Time for select_key2 (200000): 142 wallclock secs (72.16 usr 21.15 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
+Time for select_big (10:3000000): 36 wallclock secs (20.53 usr 14.90 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
+Time for order_by_big_key (10:3000000): 38 wallclock secs (22.77 usr 15.36 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
+Time for order_by_big_key_desc (10:3000000): 38 wallclock secs (22.72 usr 15.24 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
+Time for order_by_big_key_prefix (10:3000000): 35 wallclock secs (19.98 usr 14.81 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
+Time for order_by_big_key2 (10:3000000): 35 wallclock secs (19.87 usr 14.91 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
+Time for order_by_big_key_diff (10:3000000): 49 wallclock secs (20.43 usr 21.94 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
+Time for order_by_big (10:3000000): 53 wallclock secs (20.57 usr 21.79 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
+Time for order_by_range (500:125750): 4 wallclock secs ( 1.09 usr 0.62 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
+Time for order_by_key_prefix (500:125750): 3 wallclock secs ( 1.07 usr 0.64 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
+Time for order_by_key2_diff (500:250500): 5 wallclock secs ( 1.81 usr 1.27 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
+Time for select_diff_key (500:1000): 151 wallclock secs ( 0.25 usr 0.04 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
+Time for select_range_prefix (5010:42084): 10 wallclock secs ( 2.87 usr 0.92 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
+Time for select_range_key2 (5010:42084): 11 wallclock secs ( 2.92 usr 1.02 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
+Time for select_key_prefix (200000): 147 wallclock secs (76.05 usr 21.66 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
+Time for select_key (200000): 141 wallclock secs (75.34 usr 22.71 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
+Time for select_key2 (200000): 146 wallclock secs (75.75 usr 22.08 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Test of compares with simple ranges
-Time for select_range_prefix (20000:43500): 9 wallclock secs ( 3.68 usr 1.28 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
-Time for select_range_key2 (20000:43500): 9 wallclock secs ( 3.67 usr 1.33 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
-Time for select_group (111): 39 wallclock secs ( 0.04 usr 0.01 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
-Time for min_max_on_key (15000): 9 wallclock secs ( 4.64 usr 1.33 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
-Time for min_max (60): 20 wallclock secs ( 0.02 usr 0.00 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
-Time for count_on_key (100): 39 wallclock secs ( 0.04 usr 0.01 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
-Time for count (100): 48 wallclock secs ( 0.03 usr 0.01 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
-Time for count_distinct_big (20): 55 wallclock secs ( 0.01 usr 0.00 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
+Time for select_range_prefix (20000:43500): 9 wallclock secs ( 3.78 usr 1.32 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
+Time for select_range_key2 (20000:43500): 8 wallclock secs ( 3.80 usr 1.28 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
+Time for select_group (111): 40 wallclock secs ( 0.04 usr 0.02 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
+Time for min_max_on_key (15000): 9 wallclock secs ( 4.77 usr 1.28 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
+Time for min_max (60): 22 wallclock secs ( 0.02 usr 0.01 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
+Time for count_on_key (100): 40 wallclock secs ( 0.04 usr 0.01 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
+Time for count (100): 50 wallclock secs ( 0.04 usr 0.01 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
+Time for count_distinct_big (20): 52 wallclock secs ( 0.01 usr 0.01 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Testing update of keys with functions
-Time for update_of_key (50000): 27 wallclock secs ( 3.43 usr 3.03 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
-Time for update_of_key_big (501): 18 wallclock secs ( 0.04 usr 0.03 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
+Time for update_of_key (50000): 27 wallclock secs ( 3.58 usr 3.11 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
+Time for update_of_key_big (501): 19 wallclock secs ( 0.04 usr 0.03 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Testing update with key
-Time for update_with_key (300000): 134 wallclock secs (18.92 usr 18.69 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
+Time for update_with_key (300000): 135 wallclock secs (21.98 usr 17.77 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
+Time for update_with_key_prefix (100000): 42 wallclock secs ( 7.22 usr 5.96 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Testing update of all rows
-Time for update_big (10): 27 wallclock secs ( 0.00 usr 0.00 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
+Time for update_big (10): 26 wallclock secs ( 0.00 usr 0.00 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Testing left outer join
-Time for outer_join_on_key (10:10): 38 wallclock secs ( 0.01 usr 0.00 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
-Time for outer_join (10:10): 57 wallclock secs ( 0.00 usr 0.00 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
-Time for outer_join_found (10:10): 52 wallclock secs ( 0.00 usr 0.00 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
-Time for outer_join_not_found (500:10): 34 wallclock secs ( 0.00 usr 0.00 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
+Time for outer_join_on_key (10:10): 44 wallclock secs ( 0.00 usr 0.00 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
+Time for outer_join (10:10): 60 wallclock secs ( 0.00 usr 0.00 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
+Time for outer_join_found (10:10): 56 wallclock secs ( 0.00 usr 0.00 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
+Time for outer_join_not_found (500:10): 37 wallclock secs ( 0.00 usr 0.00 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Testing INSERT INTO ... SELECT
-Time for insert_select_1_key (1): 5 wallclock secs ( 0.00 usr 0.00 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
+Time for insert_select_1_key (1): 6 wallclock secs ( 0.00 usr 0.00 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for insert_select_2_keys (1): 6 wallclock secs ( 0.00 usr 0.00 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
-Time for drop table(2): 1 wallclock secs ( 0.00 usr 0.00 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
+Time for drop table(2): 0 wallclock secs ( 0.00 usr 0.00 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Testing delete
-Time for delete_key (10000): 4 wallclock secs ( 0.66 usr 0.53 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
+Time for delete_key (10000): 5 wallclock secs ( 0.60 usr 0.53 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for delete_all (12): 11 wallclock secs ( 0.00 usr 0.00 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Insert into table with 16 keys and with a primary key with 16 parts
-Time for insert_key (100000): 94 wallclock secs ( 7.67 usr 5.66 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
+Time for insert_key (100000): 96 wallclock secs ( 8.23 usr 5.98 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Testing update of keys
Time for update_of_key (256): 21 wallclock secs ( 0.02 usr 0.01 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Deleting rows from the table
-Time for delete_big_many_keys (128): 49 wallclock secs ( 0.02 usr 0.01 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
+Time for delete_big_many_keys (128): 50 wallclock secs ( 0.01 usr 0.01 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Deleting everything from table
-Time for delete_all_many_keys (1): 49 wallclock secs ( 0.02 usr 0.01 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
+Time for delete_all_many_keys (1): 50 wallclock secs ( 0.01 usr 0.01 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Inserting 100000 rows with multiple values
-Time for multiple_value_insert (100000): 7 wallclock secs ( 2.15 usr 0.05 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
+Time for multiple_value_insert (100000): 7 wallclock secs ( 2.08 usr 0.05 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for drop table(1): 0 wallclock secs ( 0.00 usr 0.00 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
-Total time: 1821 wallclock secs (430.65 usr 226.65 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
+Total time: 1932 wallclock secs (465.91 usr 251.37 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
diff --git a/sql-bench/Results/select-mysql-Linux_2.2.13_SMP_alpha b/sql-bench/Results/select-mysql-Linux_2.2.13_SMP_alpha
index 15746c34a1a..818e562797c 100644
--- a/sql-bench/Results/select-mysql-Linux_2.2.13_SMP_alpha
+++ b/sql-bench/Results/select-mysql-Linux_2.2.13_SMP_alpha
@@ -1,23 +1,23 @@
-Testing server 'MySQL 3.23.29 gamma' at 2000-11-28 18:06:37
+Testing server 'MySQL 3.23.30 gamma' at 2000-12-28 16:14:21
Testing the speed of selecting on keys that consist of many parts
The test-table has 10000 rows and the test is done with 500 ranges.
Creating table
Inserting 10000 rows
-Time to insert (10000): 4 wallclock secs ( 0.76 usr 0.58 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
+Time to insert (10000): 3 wallclock secs ( 0.72 usr 0.71 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Testing big selects on the table
Time for select_big (70:17207): 1 wallclock secs ( 0.14 usr 0.09 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
-Time for select_range (410:1057904): 229 wallclock secs ( 8.56 usr 5.62 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
-Time for min_max_on_key (70000): 166 wallclock secs (21.04 usr 6.26 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
-Time for count_on_key (50000): 389 wallclock secs (15.72 usr 4.52 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
+Time for select_range (410:1057904): 227 wallclock secs ( 9.67 usr 5.91 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
+Time for min_max_on_key (70000): 153 wallclock secs (21.55 usr 6.38 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
+Time for count_on_key (50000): 355 wallclock secs (16.42 usr 4.53 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
-Time for count_group_on_key_parts (1000:100000): 40 wallclock secs ( 1.00 usr 0.61 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
+Time for count_group_on_key_parts (1000:100000): 38 wallclock secs ( 1.16 usr 0.66 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Testing count(distinct) on the table
-Time for count_distinct (2000:2000): 92 wallclock secs ( 0.69 usr 0.21 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
-Time for count_distinct_group_on_key (1000:6000): 42 wallclock secs ( 0.43 usr 0.14 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
-Time for count_distinct_group_on_key_parts (1000:100000): 63 wallclock secs ( 1.10 usr 0.62 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
-Time for count_distinct_group (1000:100000): 64 wallclock secs ( 1.06 usr 0.66 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
-Time for count_distinct_big (100:1000000): 80 wallclock secs ( 7.23 usr 8.53 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
-Total time: 1170 wallclock secs (57.76 usr 27.85 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
+Time for count_distinct (2000:2000): 102 wallclock secs ( 0.71 usr 0.21 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
+Time for count_distinct_group_on_key (1000:6000): 42 wallclock secs ( 0.45 usr 0.16 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
+Time for count_distinct_group_on_key_parts (1000:100000): 62 wallclock secs ( 1.20 usr 0.66 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
+Time for count_distinct_group (1000:100000): 63 wallclock secs ( 1.16 usr 0.69 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
+Time for count_distinct_big (100:1000000): 81 wallclock secs ( 8.00 usr 9.24 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
+Total time: 1127 wallclock secs (61.16 usr 29.24 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
diff --git a/sql-bench/Results/wisconsin-mysql-Linux_2.2.13_SMP_alpha b/sql-bench/Results/wisconsin-mysql-Linux_2.2.13_SMP_alpha
index f94cecbed8e..7f7bd4f6b71 100644
--- a/sql-bench/Results/wisconsin-mysql-Linux_2.2.13_SMP_alpha
+++ b/sql-bench/Results/wisconsin-mysql-Linux_2.2.13_SMP_alpha
@@ -1,14 +1,14 @@
-Testing server 'MySQL 3.23.29 gamma' at 2000-11-28 18:26:07
+Testing server 'MySQL 3.23.30 gamma' at 2000-12-28 16:33:09
Wisconsin benchmark test
Time for create_table (3): 0 wallclock secs ( 0.00 usr 0.00 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Inserting data
-Time to insert (31000): 14 wallclock secs ( 1.82 usr 1.89 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
+Time to insert (31000): 14 wallclock secs ( 1.87 usr 1.88 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time to delete_big (1): 0 wallclock secs ( 0.00 usr 0.00 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Running actual benchmark
-Time for wisc_benchmark (114): 4 wallclock secs ( 1.88 usr 0.93 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
+Time for wisc_benchmark (114): 4 wallclock secs ( 1.71 usr 0.98 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
-Total time: 18 wallclock secs ( 3.70 usr 2.82 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
+Total time: 18 wallclock secs ( 3.58 usr 2.86 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
diff --git a/sql/gen_lex_hash.cc b/sql/gen_lex_hash.cc
index e77081c64a0..efaf7411c55 100644
--- a/sql/gen_lex_hash.cc
+++ b/sql/gen_lex_hash.cc
@@ -330,7 +330,7 @@ static struct option long_options[] =
static void usage(int version)
{
- printf("%s Ver 3.1 Distrib %s, for %s (%s)\n",
+ printf("%s Ver 3.2 Distrib %s, for %s (%s)\n",
my_progname, MYSQL_SERVER_VERSION, SYSTEM_TYPE, MACHINE_TYPE);
if (version)
return;
@@ -350,7 +350,7 @@ static void usage(int version)
}
static uint best_type;
-static ulong best_t1,best_t2;
+static ulong best_t1,best_t2, best_start_value;
static int get_options(int argc, char **argv)
{
@@ -472,7 +472,7 @@ int main(int argc,char **argv)
int error;
MY_INIT(argv[0]);
- start_value=5206280L; best_t1=590774L; best_t2=5977654L; best_type=1; /* mode=6229 add=2 func_type: 0 */
+ start_value=4424889L; best_t1=3207460L; best_t2=481534L; best_type=0; /* mode=4451 add=8 type: 0 */
if (get_options(argc,(char **) argv))
exit(1);
@@ -510,8 +510,10 @@ int main(int argc,char **argv)
best_mod=function_mod; best_add=function_plus;
best_functype=function_type;
best_t1=t1; best_t2=t2; best_type=type;
- printf("\nstart_value=%ldL; best_t1=%ldL; best_t2=%ldL; best_type=%d; /* mode=%d add=%d func_type: %d */\n",
- start_value,best_t1,best_t2,best_type,best_mod,best_add,best_functype);
+ best_start_value=start_value;
+ printf("\nstart_value=%ldL; best_t1=%ldL; best_t2=%ldL; best_type=%d; /* mode=%d add=%d type: %d */\n",
+ best_start_value,best_t1,best_t2,best_type,best_mod,best_add,
+ best_functype);
}
}
}
@@ -537,8 +539,8 @@ printf("/* This code is generated by gen_lex_hash.cc that seeks for a perfect\nh
print_arrays();
- printf("/* start_value=%ldL; best_t1=%ldL; best_t2=%ldL; best_type=%d; */ /* mode=%d add=%d type: %d */\n\n",
- start_value, best_t1, best_t2,best_type,
+ printf("/* start_value=%ldL; best_t1=%ldL; best_t2=%ldL; best_type=%d; */ /* mode=%d add=%d type: %d */\n\n",
+ best_start_value, best_t1, best_t2, best_type,
best_mod, best_add, best_functype);
printf("inline SYMBOL *get_hash_symbol(const char *s,unsigned int length,bool function)\n\
diff --git a/sql/ha_berkeley.cc b/sql/ha_berkeley.cc
index 0db001783c1..8dbf15068b5 100644
--- a/sql/ha_berkeley.cc
+++ b/sql/ha_berkeley.cc
@@ -81,7 +81,7 @@ u_int32_t berkeley_init_flags= DB_PRIVATE | DB_RECOVER, berkeley_env_flags=0,
ulong berkeley_cache_size;
char *berkeley_home, *berkeley_tmpdir, *berkeley_logdir;
long berkeley_lock_scan_time=0;
-ulong berkeley_trans_retry=5;
+ulong berkeley_trans_retry=1;
ulong berkeley_max_lock;
pthread_mutex_t bdb_mutex;
@@ -89,7 +89,7 @@ static DB_ENV *db_env;
static HASH bdb_open_tables;
const char *berkeley_lock_names[] =
-{ "DEFAULT", "OLDEST","RANDOM","YOUNGEST" };
+{ "DEFAULT", "OLDEST","RANDOM","YOUNGEST",0 };
u_int32_t berkeley_lock_types[]=
{ DB_LOCK_DEFAULT, DB_LOCK_OLDEST, DB_LOCK_RANDOM };
TYPELIB berkeley_lock_typelib= {array_elements(berkeley_lock_names),"",
@@ -99,7 +99,7 @@ static void berkeley_print_error(const char *db_errpfx, char *buffer);
static byte* bdb_get_key(BDB_SHARE *share,uint *length,
my_bool not_used __attribute__((unused)));
static BDB_SHARE *get_share(const char *table_name, TABLE *table);
-static void free_share(BDB_SHARE *share, TABLE *table);
+static int free_share(BDB_SHARE *share, TABLE *table, uint hidden_primary_key);
static int write_status(DB *status_block, char *buff, uint length);
static void update_status(BDB_SHARE *share, TABLE *table);
static void berkeley_noticecall(DB_ENV *db_env, db_notices notice);
@@ -433,8 +433,6 @@ int ha_berkeley::open(const char *name, int mode, uint test_if_locked)
uint max_key_length= table->max_key_length + MAX_REF_PARTS*2;
if (!(alloc_ptr=
my_multi_malloc(MYF(MY_WME),
- &key_file, (table->keys+1)*sizeof(*key_file),
- &key_type, (table->keys+1)*sizeof(u_int32_t),
&key_buff, max_key_length,
&key_buff2, max_key_length,
&primary_key_buff,
@@ -449,7 +447,7 @@ int ha_berkeley::open(const char *name, int mode, uint test_if_locked)
DBUG_RETURN(1);
}
- /* Init table lock structure */
+ /* Init shared structure */
if (!(share=get_share(name,table)))
{
my_free(rec_buff,MYF(0));
@@ -457,82 +455,93 @@ int ha_berkeley::open(const char *name, int mode, uint test_if_locked)
DBUG_RETURN(1);
}
thr_lock_data_init(&share->lock,&lock,(void*) 0);
+ key_file = share->key_file;
+ key_type = share->key_type;
- if ((error=db_create(&file, db_env, 0)))
+ /* Fill in shared structure, if needed */
+ pthread_mutex_lock(&share->mutex);
+ file = share->file;
+ if (!share->use_count++)
{
- free_share(share,table);
- my_free(rec_buff,MYF(0));
- my_free(alloc_ptr,MYF(0));
- my_errno=error;
- DBUG_RETURN(1);
- }
+ if ((error=db_create(&file, db_env, 0)))
+ {
+ free_share(share,table, hidden_primary_key);
+ my_free(rec_buff,MYF(0));
+ my_free(alloc_ptr,MYF(0));
+ my_errno=error;
+ DBUG_RETURN(1);
+ }
+ share->file = file;
+
+ file->set_bt_compare(file,
+ (hidden_primary_key ? berkeley_cmp_hidden_key :
+ berkeley_cmp_packed_key));
+ if (!hidden_primary_key)
+ file->app_private= (void*) (table->key_info+table->primary_key);
+ if ((error=(file->open(file, fn_format(name_buff,name,"", ha_berkeley_ext,
+ 2 | 4),
+ "main", DB_BTREE, open_mode,0))))
+ {
+ free_share(share,table, hidden_primary_key);
+ my_free(rec_buff,MYF(0));
+ my_free(alloc_ptr,MYF(0));
+ my_errno=error;
+ DBUG_RETURN(1);
+ }
- file->set_bt_compare(file,
- (hidden_primary_key ? berkeley_cmp_hidden_key :
- berkeley_cmp_packed_key));
- if (!hidden_primary_key)
- file->app_private= (void*) (table->key_info+table->primary_key);
- if ((error=(file->open(file, fn_format(name_buff,name,"", ha_berkeley_ext,
- 2 | 4),
- "main", DB_BTREE, open_mode,0))))
- {
- free_share(share,table);
- my_free(rec_buff,MYF(0));
- my_free(alloc_ptr,MYF(0));
- my_errno=error;
- DBUG_RETURN(1);
+ /* Open other keys */
+ key_file[primary_key]=file;
+ key_type[primary_key]=DB_NOOVERWRITE;
+ bzero((char*) &current_row,sizeof(current_row));
+
+ DB **ptr=key_file;
+ for (uint i=0, used_keys=0; i < table->keys ; i++, ptr++)
+ {
+ char part[7];
+ if (i != primary_key)
+ {
+ if ((error=db_create(ptr, db_env, 0)))
+ {
+ close();
+ my_errno=error;
+ DBUG_RETURN(1);
+ }
+ sprintf(part,"key%02d",++used_keys);
+ key_type[i]=table->key_info[i].flags & HA_NOSAME ? DB_NOOVERWRITE : 0;
+ (*ptr)->set_bt_compare(*ptr, berkeley_cmp_packed_key);
+ (*ptr)->app_private= (void*) (table->key_info+i);
+ if (!(table->key_info[i].flags & HA_NOSAME))
+ (*ptr)->set_flags(*ptr, DB_DUP);
+ if ((error=((*ptr)->open(*ptr, name_buff, part, DB_BTREE,
+ open_mode, 0))))
+ {
+ close();
+ my_errno=error;
+ DBUG_RETURN(1);
+ }
+ }
+ }
+ /* Calculate pack_length of primary key */
+ if (!hidden_primary_key)
+ {
+ ref_length=0;
+ KEY_PART_INFO *key_part= table->key_info[primary_key].key_part;
+ KEY_PART_INFO *end=key_part+table->key_info[primary_key].key_parts;
+ for ( ; key_part != end ; key_part++)
+ ref_length+= key_part->field->max_packed_col_length(key_part->length);
+ fixed_length_primary_key=
+ (ref_length == table->key_info[primary_key].key_length);
+ share->status|=STATUS_PRIMARY_KEY_INIT;
+ }
}
+ pthread_mutex_unlock(&share->mutex);
transaction=0;
cursor=0;
key_read=0;
fixed_length_row=!(table->db_create_options & HA_OPTION_PACK_RECORD);
- /* Open other keys */
- bzero((char*) key_file,sizeof(*key_file)*table->keys);
- key_file[primary_key]=file;
- key_type[primary_key]=DB_NOOVERWRITE;
- bzero((char*) &current_row,sizeof(current_row));
- DB **ptr=key_file;
- for (uint i=0, used_keys=0; i < table->keys ; i++, ptr++)
- {
- char part[7];
- if (i != primary_key)
- {
- if ((error=db_create(ptr, db_env, 0)))
- {
- close();
- my_errno=error;
- DBUG_RETURN(1);
- }
- sprintf(part,"key%02d",++used_keys);
- key_type[i]=table->key_info[i].flags & HA_NOSAME ? DB_NOOVERWRITE : 0;
- (*ptr)->set_bt_compare(*ptr, berkeley_cmp_packed_key);
- (*ptr)->app_private= (void*) (table->key_info+i);
- if (!(table->key_info[i].flags & HA_NOSAME))
- (*ptr)->set_flags(*ptr, DB_DUP);
- if ((error=((*ptr)->open(*ptr, name_buff, part, DB_BTREE,
- open_mode, 0))))
- {
- close();
- my_errno=error;
- DBUG_RETURN(1);
- }
- }
- }
- /* Calculate pack_length of primary key */
- if (!hidden_primary_key)
- {
- ref_length=0;
- KEY_PART_INFO *key_part= table->key_info[primary_key].key_part;
- KEY_PART_INFO *end=key_part+table->key_info[primary_key].key_parts;
- for ( ; key_part != end ; key_part++)
- ref_length+= key_part->field->max_packed_col_length(key_part->length);
- fixed_length_primary_key=
- (ref_length == table->key_info[primary_key].key_length);
- share->status|=STATUS_PRIMARY_KEY_INIT;
- }
get_status();
info(HA_STATUS_NO_LOCK | HA_STATUS_VARIABLE | HA_STATUS_CONST);
DBUG_RETURN(0);
@@ -541,21 +550,11 @@ int ha_berkeley::open(const char *name, int mode, uint test_if_locked)
int ha_berkeley::close(void)
{
- int error,result=0;
- uint keys=table->keys + test(hidden_primary_key);
DBUG_ENTER("ha_berkeley::close");
- for (uint i=0; i < keys; i++)
- {
- if (key_file[i] && (error=key_file[i]->close(key_file[i],0)))
- result=error;
- }
- free_share(share,table);
my_free(rec_buff,MYF(MY_ALLOW_ZERO_PTR));
my_free(alloc_ptr,MYF(MY_ALLOW_ZERO_PTR));
- if (result)
- my_errno=result;
- DBUG_RETURN(result);
+ DBUG_RETURN(free_share(share,table, hidden_primary_key));
}
@@ -796,18 +795,23 @@ int ha_berkeley::write_row(byte * record)
}
else
{
+ DB_TXN *sub_trans = transaction;
+ ulong thd_options = table->in_use->options;
for (uint retry=0 ; retry < berkeley_trans_retry ; retry++)
{
- uint keynr;
- DB_TXN *sub_trans;
- if ((error=txn_begin(db_env, transaction, &sub_trans, 0)))
- break;
- DBUG_PRINT("trans",("starting subtransaction"));
+ key_map changed_keys = 0;
+ if (using_ignore && (thd_options & OPTION_INTERNAL_SUBTRANSACTIONS))
+ {
+ if ((error=txn_begin(db_env, transaction, &sub_trans, 0)))
+ break;
+ DBUG_PRINT("trans",("starting subtransaction"));
+ }
if (!(error=file->put(file, sub_trans, create_key(&prim_key, primary_key,
key_buff, record),
&row, key_type[primary_key])))
{
- for (keynr=0 ; keynr < table->keys ; keynr++)
+ changed_keys |= (key_map) 1 << primary_key;
+ for (uint keynr=0 ; keynr < table->keys ; keynr++)
{
if (keynr == primary_key)
continue;
@@ -819,27 +823,48 @@ int ha_berkeley::write_row(byte * record)
last_dup_key=keynr;
break;
}
+ changed_keys |= (key_map) 1 << keynr;
}
}
else
last_dup_key=primary_key;
- if (!error)
- {
- DBUG_PRINT("trans",("committing subtransaction"));
- error=txn_commit(sub_trans, 0);
- }
- else
+ if (error)
{
/* Remove inserted row */
- int new_error;
DBUG_PRINT("error",("Got error %d",error));
- DBUG_PRINT("trans",("aborting subtransaction"));
- if ((new_error=txn_abort(sub_trans)))
+ if (using_ignore)
{
- error=new_error; // This shouldn't happen
- break;
+ int new_error = 0;
+ if (thd_options & OPTION_INTERNAL_SUBTRANSACTIONS)
+ {
+ DBUG_PRINT("trans",("aborting subtransaction"));
+ new_error=txn_abort(sub_trans);
+ }
+ else if (changed_keys)
+ {
+ new_error = 0;
+ for (uint keynr=0; changed_keys; keynr++, changed_keys >>= 1)
+ {
+ if (changed_keys & 1)
+ {
+ if ((new_error = remove_key(sub_trans, keynr, record,
+ (DBT*) 0, &prim_key)))
+ break;
+ }
+ }
+ }
+ if (new_error)
+ {
+ error=new_error; // This shouldn't happen
+ break;
+ }
}
}
+ else if (using_ignore && (thd_options & OPTION_INTERNAL_SUBTRANSACTIONS))
+ {
+ DBUG_PRINT("trans",("committing subtransaction"));
+ error=txn_commit(sub_trans, 0);
+ }
if (error != DB_LOCK_DEADLOCK)
break;
}
@@ -889,13 +914,15 @@ int ha_berkeley::key_cmp(uint keynr, const byte * old_row,
/*
Update a row from one value to another.
+ Clobbers key_buff2
*/
int ha_berkeley::update_primary_key(DB_TXN *trans, bool primary_key_changed,
- const byte * old_row,
- const byte * new_row, DBT *prim_key)
+ const byte * old_row, DBT *old_key,
+ const byte * new_row, DBT *new_key,
+ ulong thd_options, bool local_using_ignore)
{
- DBT row, old_key;
+ DBT row;
int error;
DBUG_ENTER("update_primary_key");
@@ -903,37 +930,83 @@ int ha_berkeley::update_primary_key(DB_TXN *trans, bool primary_key_changed,
{
// Primary key changed or we are updating a key that can have duplicates.
// Delete the old row and add a new one
- create_key(&old_key, primary_key, key_buff2, old_row);
- if ((error=remove_key(trans, primary_key, old_row, (DBT *) 0, &old_key)))
- DBUG_RETURN(error); // This should always succeed
- if ((error=pack_row(&row, new_row, 0)))
- {
- // Out of memory (this shouldn't happen!)
- (void) file->put(file, trans, &old_key, &row,
- key_type[primary_key]);
- DBUG_RETURN(error);
- }
- // Write new key
- if ((error=file->put(file, trans, prim_key, &row, key_type[primary_key])))
+ if (!(error=remove_key(trans, primary_key, old_row, (DBT *) 0, old_key)))
{
- // Probably a duplicated key; Return the error and let the caller
- // abort.
- last_dup_key=primary_key;
- DBUG_RETURN(error);
+ if (!(error=pack_row(&row, new_row, 0)))
+ {
+ if ((error=file->put(file, trans, new_key, &row,
+ key_type[primary_key])))
+ {
+ // Probably a duplicated key; restore old key and row if needed
+ last_dup_key=primary_key;
+ if (local_using_ignore &&
+ !(thd_options & OPTION_INTERNAL_SUBTRANSACTIONS))
+ {
+ int new_error;
+ if ((new_error=pack_row(&row, old_row, 0)) ||
+ (new_error=file->put(file, trans, old_key, &row,
+ key_type[primary_key])))
+ error=new_error; // fatal error
+ }
+ }
+ }
}
}
else
{
// Primary key didn't change; just update the row data
- if ((error=pack_row(&row, new_row, 0)))
- DBUG_RETURN(error);
- error=file->put(file, trans, prim_key, &row, 0);
- if (error)
- DBUG_RETURN(error); // Fatal error
+ if (!(error=pack_row(&row, new_row, 0)))
+ error=file->put(file, trans, new_key, &row, 0);
}
- DBUG_RETURN(0);
+ DBUG_RETURN(error);
}
+/*
+ Restore changed keys, when a non-fatal error aborts the insert/update
+ of one row.
+ Clobbers keybuff2
+*/
+
+int ha_berkeley::restore_keys(DB_TXN *trans, key_map changed_keys,
+ uint primary_key,
+ const byte *old_row, DBT *old_key,
+ const byte *new_row, DBT *new_key,
+ ulong thd_options)
+{
+ int error;
+ DBT tmp_key;
+ DBUG_ENTER("restore_keys");
+
+ /* Restore the old primary key, and the old row, but don't ignore
+ duplicate key failure */
+ if ((error=update_primary_key(trans, TRUE, new_row, new_key,
+ old_row, old_key, thd_options, FALSE)))
+ goto err;
+
+ /* Remove the new key, and put back the old key
+ changed_keys is a map of all non-primary keys that need to be
+ rolled back. The last key set in changed_keys is the one that
+ triggered the duplicate key error (it wasn't inserted), so for
+ that one just put back the old value. */
+ for (uint keynr=0; changed_keys; keynr++, changed_keys >>= 1)
+ {
+ if (changed_keys & 1)
+ {
+ if (changed_keys != 1 &&
+ (error = remove_key(trans, keynr, new_row, (DBT*) 0, new_key)))
+ break;
+ if ((error = key_file[keynr]->put(key_file[keynr], trans,
+ create_key(&tmp_key, keynr, key_buff2,
+ old_row),
+ old_key, key_type[keynr])))
+ break;
+ }
+ }
+
+err:
+ dbug_assert(error != DB_KEYEXIST);
+ DBUG_RETURN(error);
+}
int ha_berkeley::update_row(const byte * old_row, byte * new_row)
@@ -941,6 +1014,7 @@ int ha_berkeley::update_row(const byte * old_row, byte * new_row)
DBT prim_key, key, old_prim_key;
int error;
DB_TXN *sub_trans;
+ ulong thd_options = table->in_use->options;
bool primary_key_changed;
DBUG_ENTER("update_row");
@@ -966,15 +1040,22 @@ int ha_berkeley::update_row(const byte * old_row, byte * new_row)
old_prim_key=prim_key;
}
+ sub_trans = transaction;
LINT_INIT(error);
for (uint retry=0 ; retry < berkeley_trans_retry ; retry++)
{
- if ((error=txn_begin(db_env, transaction, &sub_trans, 0)))
- break;
- DBUG_PRINT("trans",("starting subtransaction"));
+ key_map changed_keys = 0;
+ if (using_ignore && (thd_options & OPTION_INTERNAL_SUBTRANSACTIONS))
+ {
+ if ((error=txn_begin(db_env, transaction, &sub_trans, 0)))
+ break;
+ DBUG_PRINT("trans",("starting subtransaction"));
+ }
/* Start by updating the primary key */
if (!(error=update_primary_key(sub_trans, primary_key_changed,
- old_row, new_row, &prim_key)))
+ old_row, &old_prim_key,
+ new_row, &prim_key,
+ thd_options, using_ignore)))
{
// Update all other keys
for (uint keynr=0 ; keynr < table->keys ; keynr++)
@@ -984,10 +1065,23 @@ int ha_berkeley::update_row(const byte * old_row, byte * new_row)
if (key_cmp(keynr, old_row, new_row) || primary_key_changed)
{
if ((error=remove_key(sub_trans, keynr, old_row, (DBT*) 0,
- &old_prim_key)) ||
- (error=key_file[keynr]->put(key_file[keynr], sub_trans,
+ &old_prim_key)))
+ {
+ if (using_ignore &&
+ (thd_options & OPTION_INTERNAL_SUBTRANSACTIONS))
+ {
+ int new_error;
+ DBUG_PRINT("trans",("aborting subtransaction"));
+ new_error=txn_abort(sub_trans);
+ if (new_error)
+ error = new_error;
+ }
+ DBUG_RETURN(error); // Fatal error
+ }
+ changed_keys |= (key_map)1 << keynr;
+ if ((error=key_file[keynr]->put(key_file[keynr], sub_trans,
create_key(&key, keynr, key_buff2,
- new_row),
+ new_row),
&prim_key, key_type[keynr])))
{
last_dup_key=keynr;
@@ -996,22 +1090,50 @@ int ha_berkeley::update_row(const byte * old_row, byte * new_row)
}
}
}
- if (!error)
- {
- DBUG_PRINT("trans",("committing subtransaction"));
- error=txn_commit(sub_trans, 0);
- }
- else
+ if (error)
{
/* Remove inserted row */
+ DBUG_PRINT("error",("Got error %d",error));
+ if (using_ignore)
+ {
+ int new_error = 0;
+ if (thd_options & OPTION_INTERNAL_SUBTRANSACTIONS)
+ {
+ DBUG_PRINT("trans",("aborting subtransaction"));
+ new_error=txn_abort(sub_trans);
+ }
+ else if (changed_keys)
+ new_error=restore_keys(transaction, changed_keys, primary_key,
+ old_row, &old_prim_key, new_row, &prim_key,
+ thd_options);
+ if (new_error)
+ {
+ error=new_error; // This shouldn't happen
+ break;
+ }
+ }
+#ifdef BROKEN_CODE_HERE
int new_error;
DBUG_PRINT("error",("Got error %d",error));
- DBUG_PRINT("trans",("aborting subtransaction"));
- if ((new_error=txn_abort(sub_trans)))
+ if (using_ignore && (thd_options & OPTION_INTERNAL_SUBTRANSACTIONS))
+ {
+ DBUG_PRINT("trans",("aborting subtransaction"));
+ new_error=txn_abort(sub_trans);
+ }
+ else if (changed_keys)
+ new_error=restore_keys(changed_keys, primary_key,
+ old_row, old_prim_key, new_row, prim_key);
+ if (new_error)
{
error=new_error; // This shouldn't happen
break;
}
+#endif
+ }
+ else if (using_ignore && (thd_options & OPTION_INTERNAL_SUBTRANSACTIONS))
+ {
+ DBUG_PRINT("trans",("committing subtransaction"));
+ error=txn_commit(sub_trans, 0);
}
if (error != DB_LOCK_DEADLOCK)
break;
@@ -1029,7 +1151,7 @@ int ha_berkeley::update_row(const byte * old_row, byte * new_row)
packed_record may be NULL if the key is unique
*/
-int ha_berkeley::remove_key(DB_TXN *sub_trans, uint keynr, const byte *record,
+int ha_berkeley::remove_key(DB_TXN *trans, uint keynr, const byte *record,
DBT *packed_record,
DBT *prim_key)
{
@@ -1042,7 +1164,7 @@ int ha_berkeley::remove_key(DB_TXN *sub_trans, uint keynr, const byte *record,
HA_NOSAME || keynr == primary_key)
{ // Unique key
dbug_assert(keynr == primary_key || prim_key->data != key_buff2);
- error=key_file[keynr]->del(key_file[keynr], sub_trans,
+ error=key_file[keynr]->del(key_file[keynr], trans,
keynr == primary_key ?
prim_key :
create_key(&key, keynr, key_buff2, record),
@@ -1057,7 +1179,7 @@ int ha_berkeley::remove_key(DB_TXN *sub_trans, uint keynr, const byte *record,
*/
dbug_assert(keynr != primary_key && prim_key->data != key_buff2);
DBC *tmp_cursor;
- if (!(error=file->cursor(key_file[keynr], sub_trans, &tmp_cursor, 0)))
+ if (!(error=file->cursor(key_file[keynr], trans, &tmp_cursor, 0)))
{
if (!(error=cursor->c_get(tmp_cursor,
(keynr == primary_key ?
@@ -1065,7 +1187,7 @@ int ha_berkeley::remove_key(DB_TXN *sub_trans, uint keynr, const byte *record,
create_key(&key, keynr, key_buff2, record)),
(keynr == primary_key ?
packed_record : prim_key),
- DB_GET_BOTH)))
+ DB_GET_BOTH | DB_RMW)))
{ // This shouldn't happen
error=tmp_cursor->c_del(tmp_cursor,0);
}
@@ -1081,10 +1203,10 @@ int ha_berkeley::remove_key(DB_TXN *sub_trans, uint keynr, const byte *record,
/* Delete all keys for new_record */
int ha_berkeley::remove_keys(DB_TXN *trans, const byte *record,
- DBT *new_record, DBT *prim_key, key_map keys,
- int result)
+ DBT *new_record, DBT *prim_key, key_map keys)
{
- for (uint keynr=0 ; keys ;keynr++, keys>>=1)
+ int result = 0;
+ for (uint keynr=0; keys; keynr++, keys>>=1)
{
if (keys & 1)
{
@@ -1092,8 +1214,7 @@ int ha_berkeley::remove_keys(DB_TXN *trans, const byte *record,
if (new_error)
{
result=new_error; // Return last error
- if (trans)
- break; // Let rollback correct things
+ break; // Let rollback correct things
}
}
}
@@ -1106,6 +1227,7 @@ int ha_berkeley::delete_row(const byte * record)
int error;
DBT row, prim_key;
key_map keys=table->keys_in_use;
+ ulong thd_options = table->in_use->options;
DBUG_ENTER("delete_row");
statistic_increment(ha_delete_count,&LOCK_status);
@@ -1115,30 +1237,39 @@ int ha_berkeley::delete_row(const byte * record)
if (hidden_primary_key)
keys|= (key_map) 1 << primary_key;
+ /* Subtransactions may be used in order to retry the delete in
+ case we get a DB_LOCK_DEADLOCK error. */
+ DB_TXN *sub_trans = transaction;
for (uint retry=0 ; retry < berkeley_trans_retry ; retry++)
{
- DB_TXN *sub_trans;
- if ((error=txn_begin(db_env, transaction, &sub_trans, 0)))
- break;
- DBUG_PRINT("trans",("starting sub transaction"));
- if (!error)
- error=remove_keys(sub_trans, record, &row, &prim_key, keys,0);
- if (!error)
+ if (thd_options & OPTION_INTERNAL_SUBTRANSACTIONS)
+ {
+ if ((error=txn_begin(db_env, transaction, &sub_trans, 0)))
+ break;
+ DBUG_PRINT("trans",("starting sub transaction"));
+ }
+ error=remove_keys(sub_trans, record, &row, &prim_key, keys);
+ if (!error && (thd_options & OPTION_INTERNAL_SUBTRANSACTIONS))
{
DBUG_PRINT("trans",("ending sub transaction"));
error=txn_commit(sub_trans, 0);
}
if (error)
{
- /* retry */
- int new_error;
DBUG_PRINT("error",("Got error %d",error));
- DBUG_PRINT("trans",("aborting subtransaction"));
- if ((new_error=txn_abort(sub_trans)))
+ if (thd_options & OPTION_INTERNAL_SUBTRANSACTIONS)
{
- error=new_error; // This shouldn't happen
- break;
+ /* retry */
+ int new_error;
+ DBUG_PRINT("trans",("aborting subtransaction"));
+ if ((new_error=txn_abort(sub_trans)))
+ {
+ error=new_error; // This shouldn't happen
+ break;
+ }
}
+ else
+ break; // No retry - return error
}
if (error != DB_LOCK_DEADLOCK)
break;
@@ -1401,9 +1532,7 @@ void ha_berkeley::position(const byte *record)
{
DBT key;
if (hidden_primary_key)
- {
memcpy_fixed(ref, (char*) current_ident, BDB_HIDDEN_PRIMARY_KEY_LENGTH);
- }
else
create_key(&key, primary_key, ref, record);
}
@@ -1438,6 +1567,7 @@ int ha_berkeley::extra(enum ha_extra_function operation)
case HA_EXTRA_RESET:
case HA_EXTRA_RESET_STATE:
key_read=0;
+ using_ignore=0;
break;
case HA_EXTRA_KEYREAD:
key_read=1; // Query satisfied with key
@@ -1445,6 +1575,12 @@ int ha_berkeley::extra(enum ha_extra_function operation)
case HA_EXTRA_NO_KEYREAD:
key_read=0;
break;
+ case HA_EXTRA_IGNORE_DUP_KEY:
+ using_ignore=1;
+ break;
+ case HA_EXTRA_NO_IGNORE_DUP_KEY:
+ using_ignore=0;
+ break;
default:
break;
}
@@ -1548,6 +1684,8 @@ THR_LOCK_DATA **ha_berkeley::store_lock(THD *thd, THR_LOCK_DATA **to,
!thd->in_lock_tables)
lock_type = TL_WRITE_ALLOW_WRITE;
lock.type=lock_type;
+ lock_on_read= ((table->reginfo.lock_type > TL_WRITE_ALLOW_READ) ? DB_RMW :
+ 0);
}
*to++= &lock;
return to;
@@ -1658,7 +1796,7 @@ int ha_berkeley::delete_table(const char *name)
double ha_berkeley::scan_time()
{
return records/3;
- }
+}
ha_rows ha_berkeley::records_in_range(int keynr,
const byte *start_key,uint start_key_len,
@@ -1811,7 +1949,7 @@ int ha_berkeley::analyze(THD* thd, HA_CHECK_OPT* check_opt)
stat=0;
}
if (file->stat(file, (void*) &stat, 0, 0))
- goto err;
+ goto err;
}
pthread_mutex_lock(&share->mutex);
share->rows=stat->bt_ndata;
@@ -1920,16 +2058,26 @@ static BDB_SHARE *get_share(const char *table_name, TABLE *table)
uint length=(uint) strlen(table_name);
if (!(share=(BDB_SHARE*) hash_search(&bdb_open_tables, table_name, length)))
{
- if ((share=(BDB_SHARE *) my_malloc(ALIGN_SIZE(sizeof(*share))+
- sizeof(ha_rows)* table->keys +
- length+1,
- MYF(MY_WME | MY_ZEROFILL))))
+ ha_rows *rec_per_key;
+ char *tmp_name;
+ DB **key_file;
+ u_int32_t *key_type;
+
+ if ((share=(BDB_SHARE *)
+ my_multi_malloc(MYF(MY_WME | MY_ZEROFILL),
+ &share, sizeof(*share),
+ &rec_per_key, table->keys * sizeof(ha_rows),
+ &tmp_name, length+1,
+ &key_file, (table->keys+1) * sizeof(*key_file),
+ &key_type, (table->keys+1) * sizeof(u_int32_t),
+ NullS)))
{
- share->rec_per_key= (ha_rows*) ((char*) share +
- ALIGN_SIZE(sizeof(*share)));
- share->table_name=(char*) (share->rec_per_key+table->keys);
+ share->rec_per_key = rec_per_key;
+ share->table_name = tmp_name;
share->table_name_length=length;
strmov(share->table_name,table_name);
+ share->key_file = key_file;
+ share->key_type = key_type;
if (hash_insert(&bdb_open_tables, (char*) share))
{
pthread_mutex_unlock(&bdb_mutex);
@@ -1940,25 +2088,35 @@ static BDB_SHARE *get_share(const char *table_name, TABLE *table)
pthread_mutex_init(&share->mutex,NULL);
}
}
- share->use_count++;
pthread_mutex_unlock(&bdb_mutex);
return share;
}
-static void free_share(BDB_SHARE *share, TABLE *table)
+static int free_share(BDB_SHARE *share, TABLE *table, uint hidden_primary_key)
{
+ int error, result = 0;
+ uint keys=table->keys + test(hidden_primary_key);
pthread_mutex_lock(&bdb_mutex);
if (!--share->use_count)
{
+ DB **key_file = share->key_file;
update_status(share,table);
- if (share->status_block)
- share->status_block->close(share->status_block,0);
+ /* this does share->file->close() implicitly */
+ for (uint i=0; i < keys; i++)
+ {
+ if (key_file[i] && (error=key_file[i]->close(key_file[i],0)))
+ result=error;
+ }
+ if (share->status_block &&
+ (error = share->status_block->close(share->status_block,0)))
+ result = error;
hash_delete(&bdb_open_tables, (gptr) share);
thr_lock_delete(&share->lock);
pthread_mutex_destroy(&share->mutex);
my_free((gptr) share, MYF(0));
}
pthread_mutex_unlock(&bdb_mutex);
+ return result;
}
/*
diff --git a/sql/ha_berkeley.h b/sql/ha_berkeley.h
index 1e32fdb8a7c..f0809598798 100644
--- a/sql/ha_berkeley.h
+++ b/sql/ha_berkeley.h
@@ -31,7 +31,8 @@ typedef struct st_berkeley_share {
THR_LOCK lock;
pthread_mutex_t mutex;
char *table_name;
- DB *status_block;
+ DB *status_block, *file, **key_file;
+ u_int32_t *key_type;
uint table_name_length,use_count;
uint status,version;
} BDB_SHARE;
@@ -69,11 +70,16 @@ class ha_berkeley: public handler
int remove_key(DB_TXN *trans, uint keynr, const byte *record,
DBT *packed_record, DBT *prim_key);
int remove_keys(DB_TXN *trans,const byte *record, DBT *new_record,
- DBT *prim_key, key_map keys, int result);
+ DBT *prim_key, key_map keys);
+ int restore_keys(DB_TXN *trans, key_map changed_keys, uint primary_key,
+ const byte *old_row, DBT *old_key,
+ const byte *new_row, DBT *new_key,
+ ulong thd_options);
int key_cmp(uint keynr, const byte * old_row, const byte * new_row);
int update_primary_key(DB_TXN *trans, bool primary_key_changed,
- const byte * old_row, const byte * new_row,
- DBT *prim_key);
+ const byte * old_row, DBT *old_key,
+ const byte * new_row, DBT *prim_key,
+ ulong thd_options, bool local_using_ignore);
int read_row(int error, char *buf, uint keynr, DBT *row, DBT *key, bool);
DBT *get_pos(DBT *to, byte *pos);
@@ -86,7 +92,7 @@ class ha_berkeley: public handler
HA_BLOB_KEY | HA_NOT_EXACT_COUNT |
HA_PRIMARY_KEY_IN_READ_INDEX | HA_DROP_BEFORE_CREATE |
HA_AUTO_PART_KEY),
- last_dup_key((uint) -1),version(0)
+ last_dup_key((uint) -1),version(0),using_ignore(0)
{
}
~ha_berkeley() {}
diff --git a/sql/ha_innobase.cc b/sql/ha_innobase.cc
index 58e3d540d04..ab6bd99b819 100644
--- a/sql/ha_innobase.cc
+++ b/sql/ha_innobase.cc
@@ -1971,11 +1971,17 @@ ha_innobase::external_lock(
THR_LOCK_DATA **ha_innobase::store_lock(THD *thd, THR_LOCK_DATA **to,
enum thr_lock_type lock_type)
{
- /*??????????????????*/
-
- *to++= &lock;
-
- return(to);
+ if (lock_type != TL_IGNORE && lock.type == TL_UNLOCK)
+ {
+ /* If we are not doing a LOCK TABLE, then allow multiple writers */
+ if ((lock_type >= TL_WRITE_CONCURRENT_INSERT &&
+ lock_type <= TL_WRITE) &&
+ !thd->in_lock_tables)
+ lock_type = TL_WRITE_ALLOW_WRITE;
+ lock.type=lock_type;
+ }
+ *to++= &lock;
+ return(to);
}
/*********************************************************************
diff --git a/sql/ha_myisam.cc b/sql/ha_myisam.cc
index c0f7b73a856..ecebe9d4ff2 100644
--- a/sql/ha_myisam.cc
+++ b/sql/ha_myisam.cc
@@ -1103,7 +1103,7 @@ int ha_myisam::ft_read(byte * buf)
thread_safe_increment(ha_read_next_count,&LOCK_status); // why ?
- if (error=ft_read_next((FT_DOCLIST *) ft_handler,(char*) buf))
+ if ((error=ft_read_next((FT_DOCLIST *) ft_handler,(char*) buf)))
ft_handler=NULL; // Magic here ! See Item_func_match::val()
// and ha_myisam::index_init()
table->status=error ? STATUS_NOT_FOUND: 0;
diff --git a/sql/handler.cc b/sql/handler.cc
index 930bfa2ed28..08cc3db7628 100644
--- a/sql/handler.cc
+++ b/sql/handler.cc
@@ -191,16 +191,13 @@ int ha_autocommit_or_rollback(THD *thd, int error)
{
DBUG_ENTER("ha_autocommit_or_rollback");
#ifdef USING_TRANSACTIONS
- if (!(thd->options & (OPTION_NOT_AUTO_COMMIT | OPTION_BEGIN)))
+ if (!error)
{
- if (!error)
- {
- if (ha_commit_stmt(thd))
- error=1;
- }
- else
- (void) ha_rollback_stmt(thd);
+ if (ha_commit_stmt(thd))
+ error=1;
}
+ else
+ (void) ha_rollback_stmt(thd);
#endif
DBUG_RETURN(error);
}
@@ -232,6 +229,7 @@ int ha_commit_trans(THD *thd, THD_TRANS* trans)
}
#endif
#ifdef HAVE_INNOBASE_DB
+ if (trans->innobase_tid)
{
if ((error=innobase_commit(thd,trans->innobase_tid)))
{
diff --git a/sql/handler.h b/sql/handler.h
index 571825c36ef..a4ebe9b51ff 100644
--- a/sql/handler.h
+++ b/sql/handler.h
@@ -25,7 +25,7 @@
#define NO_HASH /* Not yet implemented */
#endif
-#if defined(HAVE_BERKELEY_DB) || defined(HAVE_INNOBASE_DB) || defined(HAVE_GEMENI_DB)
+#if defined(HAVE_BERKELEY_DB) || defined(HAVE_INNOBASE_DB) || defined(HAVE_GEMINI_DB)
#define USING_TRANSACTIONS
#endif
@@ -121,7 +121,7 @@ enum row_type { ROW_TYPE_DEFAULT, ROW_TYPE_FIXED, ROW_TYPE_DYNAMIC,
typedef struct st_thd_trans {
void *bdb_tid;
void *innobase_tid;
- void *gemeni_tid;
+ void *gemini_tid;
} THD_TRANS;
typedef struct st_ha_create_information
diff --git a/sql/log_event.cc b/sql/log_event.cc
index fa6ac4f45fc..dfe8d71f146 100644
--- a/sql/log_event.cc
+++ b/sql/log_event.cc
@@ -624,7 +624,7 @@ void Load_log_event::print(FILE* file, bool short_form)
if (!short_form)
{
print_header(file);
- fprintf(file, "\tQuery\tthread_id=%d\texec_time=%ld\n",
+ fprintf(file, "\tQuery\tthread_id=%ld\texec_time=%ld\n",
thread_id, exec_time);
}
diff --git a/sql/mysql_priv.h b/sql/mysql_priv.h
index 2f171259699..6ce43d6a560 100644
--- a/sql/mysql_priv.h
+++ b/sql/mysql_priv.h
@@ -520,7 +520,7 @@ extern ulong keybuff_size,sortbuff_size,max_item_sort_length,table_cache_size,
binlog_cache_size, max_binlog_cache_size;
extern ulong specialflag, current_pid;
extern bool low_priority_updates;
-extern bool opt_sql_bin_update;
+extern bool opt_sql_bin_update, opt_safe_show_db;
extern char language[LIBLEN],reg_ext[FN_EXTLEN],blob_newline;
extern const char **errmesg; /* Error messages */
extern byte last_ref[MAX_REFLENGTH]; /* Index ref of keys */
diff --git a/sql/mysqld.cc b/sql/mysqld.cc
index d214bf46533..b788c8d122c 100644
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@ -146,6 +146,38 @@ static uint handler_count;
static bool opt_console=0;
#endif
+#ifdef HAVE_BERKELEY_DB
+SHOW_COMP_OPTION have_berkeley_db=SHOW_OPTION_YES;
+#else
+SHOW_COMP_OPTION have_berkeley_db=SHOW_OPTION_NO;
+#endif
+#ifdef HAVE_GEMINI_DB
+SHOW_COMP_OPTION have_gemini=SHOW_OPTION_YES;
+#else
+SHOW_COMP_OPTION have_gemini=SHOW_OPTION_NO;
+#endif
+#ifdef HAVE_INNOBASE_DB
+SHOW_COMP_OPTION have_innobase=SHOW_OPTION_YES;
+#else
+SHOW_COMP_OPTION have_innobase=SHOW_OPTION_NO;
+#endif
+#ifndef NO_ISAM
+SHOW_COMP_OPTION have_isam=SHOW_OPTION_YES;
+#else
+SHOW_COMP_OPTION have_isam=SHOW_OPTION_NO;
+#endif
+#ifdef USE_RAID
+SHOW_COMP_OPTION have_raid=SHOW_OPTION_YES;
+#else
+SHOW_COMP_OPTION have_raid=SHOW_OPTION_NO;
+#endif
+#ifdef HAVE_OPENSSL
+SHOW_COMP_OPTION have_ssl=SHOW_OPTION_YES;
+#else
+SHOW_COMP_OPTION have_ssl=SHOW_OPTION_NO;
+#endif
+
+
static bool opt_skip_slave_start = 0; // if set, slave is not autostarted
static ulong opt_specialflag=SPECIAL_ENGLISH;
static my_socket unix_sock= INVALID_SOCKET,ip_sock= INVALID_SOCKET;
@@ -155,9 +187,10 @@ static my_string opt_logname=0,opt_update_logname=0,
static char mysql_home[FN_REFLEN],pidfile_name[FN_REFLEN];
static pthread_t select_thread;
static bool opt_log,opt_update_log,opt_bin_log,opt_slow_log,opt_noacl,
- opt_disable_networking=0, opt_bootstrap=0,opt_skip_show_db=0,
- opt_ansi_mode=0,opt_myisam_log=0, opt_large_files=sizeof(my_off_t) > 4;
-bool opt_sql_bin_update = 0, opt_log_slave_updates = 0;
+ opt_disable_networking=0, opt_bootstrap=0,opt_skip_show_db=0,
+ opt_ansi_mode=0,opt_myisam_log=0,
+ opt_large_files=sizeof(my_off_t) > 4;
+bool opt_sql_bin_update = 0, opt_log_slave_updates = 0, opt_safe_show_db=0;
FILE *bootstrap_file=0;
int segfaulted = 0; // ensure we do not enter SIGSEGV handler twice
extern MASTER_INFO glob_mi;
@@ -1049,26 +1082,27 @@ inline static __volatile__ void trace_stack()
uchar **stack_bottom;
uchar** ebp;
LINT_INIT(ebp);
- fprintf(stderr, "Attemping backtrace, please send the info below to\
- bugs@lists.mysql.com. If you see no messages after this, something \
- went terribly wrong - report this anyway\n");
+ fprintf(stderr,
+"Attemping backtrace. You can use the following information to find out\n\
+where mysqld died. If you see no messages after this, something went\n\
+terribly wrong\n");
THD* thd = current_thd;
uint frame_count = 0;
__asm __volatile__ ("movl %%ebp,%0"
:"=r"(ebp)
:"r"(ebp));
- if(!ebp)
- {
- fprintf(stderr, "frame pointer (ebp) is NULL, did you compile with \
- -fomit-frame-pointer? Aborting backtrace\n");
- return;
- }
- if(!thd)
- {
- fprintf(stderr, "Cannot determine thread, ebp=%p, aborting backtrace\n",
- ebp);
- return;
- }
+ if (!ebp)
+ {
+ fprintf(stderr, "frame pointer (ebp) is NULL, did you compile with\n\
+-fomit-frame-pointer? Aborting backtrace\n");
+ return;
+ }
+ if (!thd)
+ {
+ fprintf(stderr, "Cannot determine thread, ebp=%p, aborting backtrace\n",
+ ebp);
+ return;
+ }
stack_bottom = (uchar**)thd->thread_stack;
if(ebp > stack_bottom || ebp < stack_bottom - thread_stack)
{
@@ -1079,20 +1113,20 @@ inline static __volatile__ void trace_stack()
fprintf(stderr, "stack range sanity check, ok, backtrace follows\n");
- while(ebp < stack_bottom)
+ while (ebp < stack_bottom)
+ {
+ uchar** new_ebp = (uchar**)*ebp;
+ fprintf(stderr, "%p\n", frame_count == SIGRETURN_FRAME_COUNT ?
+ *(ebp+17) : *(ebp+1));
+ if (new_ebp <= ebp )
{
- uchar** new_ebp = (uchar**)*ebp;
- fprintf(stderr, "%p\n", frame_count == SIGRETURN_FRAME_COUNT ?
- *(ebp+17) : *(ebp+1));
- if(new_ebp <= ebp )
- {
- fprintf(stderr, "New value of ebp failed sanity check\
+ fprintf(stderr, "New value of ebp failed sanity check\
terminating backtrace\n");
- return;
- }
- ebp = new_ebp;
- ++frame_count;
+ return;
}
+ ebp = new_ebp;
+ ++frame_count;
+ }
fprintf(stderr, "stack trace successful\n");
}
@@ -1105,31 +1139,27 @@ static sig_handler handle_segfault(int sig)
// but since we have got SIGSEGV already, things are a mess
// so not having the mutex is not as bad as possibly using a buggy
// mutex - so we keep things simple
- if(segfaulted)
+ if (segfaulted)
return;
segfaulted = 1;
fprintf(stderr,"\
-mysqld got signal %s in thread %d; \n\
-The manual section 'Debugging a MySQL server' tells you how to use a \n\
-debugger on the core file to produce a backtrace that may help you find out\n\
-why mysqld died\n",sys_siglist[sig],getpid());
-#if defined(HAVE_LINUXTHREADS) && defined(__i386__)
+mysqld got signal %d;\n\
+The manual section 'Debugging a MySQL server' tells you how to use a\n\
+stack trace and/or the core file to produce a readable backtrace that may\n\
+help in finding out why mysqld died\n",sig);
+#if defined(HAVE_LINUXTHREADS)
+#ifdef __i386__
trace_stack();
-#endif
-#ifdef HAVE_LINUXTHREADS
+#endif /* __i386__ */
if (test_flags & TEST_CORE_ON_SIGNAL)
write_core(sig);
- else
- exit(1);
-#else
- exit(1); /* abort everything */
-#endif
+#endif /* HAVE_LINUXTHREADS */
+ exit(1);
}
-#ifdef HAVE_LINUXTHREADS
-
/* Produce a core for the thread */
+#ifdef HAVE_LINUXTHREADS
static sig_handler write_core(int sig)
{
signal(sig, SIG_DFL);
@@ -1593,12 +1623,14 @@ int main(int argc, char **argv)
{
server_id= !master_host ? 1 : 2;
switch (server_id) {
+#ifdef EXTRA_DEBUG
case 1:
sql_print_error("\
Warning: one should set server_id to a non-0 value if log-bin is enabled.\n\
Will log updates to binary log, but will not accept connections from slaves");
break;
- default:
+#endif
+ case 2:
sql_print_error("\
Warning: one should set server_id to a non-0 value if master_host is set.\n\
The server will not act as a slave");
@@ -1728,7 +1760,7 @@ The server will not act as a slave");
if (master_host)
{
pthread_t hThread;
- if(!opt_skip_slave_start &&
+ if (!opt_skip_slave_start &&
pthread_create(&hThread, &connection_attrib, handle_slave, 0))
sql_print_error("Warning: Can't create thread to handle slave");
else if(opt_skip_slave_start)
@@ -2322,7 +2354,8 @@ enum options {
OPT_INNOBASE_DATA_HOME_DIR,OPT_INNOBASE_DATA_FILE_PATH,
OPT_INNOBASE_LOG_GROUP_HOME_DIR,
OPT_INNOBASE_LOG_ARCH_DIR, OPT_INNOBASE_LOG_ARCHIVE,
- OPT_INNOBASE_FLUSH_LOG_AT_TRX_COMMIT
+ OPT_INNOBASE_FLUSH_LOG_AT_TRX_COMMIT, OPT_SAFE_SHOW_DB,
+ OPT_GEMINI_SKIP,
};
static struct option long_options[] = {
@@ -2424,6 +2457,7 @@ static struct option long_options[] = {
{"replicate-rewrite-db", required_argument, 0,
(int) OPT_REPLICATE_REWRITE_DB},
{"safe-mode", no_argument, 0, (int) OPT_SAFE},
+ {"safe-show-database", no_argument, 0, (int) OPT_SAFE_SHOW_DB},
{"socket", required_argument, 0, (int) OPT_SOCKET},
{"server-id", required_argument, 0, (int) OPT_SERVER_ID},
{"set-variable", required_argument, 0, 'O'},
@@ -2433,6 +2467,9 @@ static struct option long_options[] = {
#ifdef HAVE_INNOBASE_DB
{"skip-innobase", no_argument, 0, (int) OPT_INNOBASE_SKIP},
#endif
+#ifdef HAVE_GEMINI_DB
+ {"skip-gemini", no_argument, 0, (int) OPT_GEMINI_SKIP},
+#endif
{"skip-concurrent-insert", no_argument, 0, (int) OPT_SKIP_CONCURRENT_INSERT},
{"skip-delay-key-write", no_argument, 0, (int) OPT_SKIP_DELAY_KEY_WRITE},
{"skip-grant-tables", no_argument, 0, (int) OPT_SKIP_GRANT},
@@ -2514,7 +2551,7 @@ CHANGEABLE_VAR changeable_vars[] = {
{ "lower_case_table_names", (long*) &lower_case_table_names,
IF_WIN(1,0), 0, 1, 0, 1 },
{ "max_allowed_packet", (long*) &max_allowed_packet,
- 1024*1024L, 80, 17*1024*1024L, MALLOC_OVERHEAD, 1024 },
+ 1024*1024L, 80, 64*1024*1024L, MALLOC_OVERHEAD, 1024 },
{ "max_binlog_cache_size", (long*) &max_binlog_cache_size,
~0L, IO_SIZE, ~0L, 0, IO_SIZE },
{ "max_connections", (long*) &max_connections,
@@ -2593,6 +2630,12 @@ struct show_var_st init_vars[]= {
{"delayed_queue_size", (char*) &delayed_queue_size, SHOW_LONG},
{"flush", (char*) &myisam_flush, SHOW_MY_BOOL},
{"flush_time", (char*) &flush_time, SHOW_LONG},
+ {"have_bdb", (char*) &have_berkeley_db, SHOW_HAVE},
+ {"have_gemini", (char*) &have_gemini, SHOW_HAVE},
+ {"have_innobase", (char*) &have_innobase, SHOW_HAVE},
+ {"have_isam", (char*) &have_isam, SHOW_HAVE},
+ {"have_raid", (char*) &have_raid, SHOW_HAVE},
+ {"have_ssl", (char*) &have_ssl, SHOW_HAVE},
{"init_file", (char*) &opt_init_file, SHOW_CHAR_PTR},
{"interactive_timeout", (char*) &net_interactive_timeout, SHOW_LONG},
{"join_buffer_size", (char*) &join_buff_size, SHOW_LONG},
@@ -2631,6 +2674,7 @@ struct show_var_st init_vars[]= {
{"protocol_version", (char*) &protocol_version, SHOW_INT},
{"record_buffer", (char*) &my_default_record_cache_size,SHOW_LONG},
{"query_buffer_size", (char*) &query_buff_size, SHOW_LONG},
+ {"safe_show_database", (char*) &opt_safe_show_db, SHOW_BOOL},
{"server_id", (char*) &server_id, SHOW_LONG},
{"skip_locking", (char*) &my_disable_locking, SHOW_MY_BOOL},
{"skip_networking", (char*) &opt_disable_networking, SHOW_BOOL},
@@ -3066,7 +3110,7 @@ static void get_options(int argc,char **argv)
{
char* key = optarg,*p, *val;
p = strstr(optarg, "->");
- if(!p)
+ if (!p)
{
fprintf(stderr,
"bad syntax in replicate-rewrite-db - missing ->\n");
@@ -3083,7 +3127,7 @@ static void get_options(int argc,char **argv)
*val = 0;
val += 2;
while(*val && isspace(*val)) *val++;
- if(!*val)
+ if (!*val)
{
fprintf(stderr,
"bad syntax in replicate-rewrite-db - empty TO db\n");
@@ -3109,7 +3153,7 @@ static void get_options(int argc,char **argv)
}
case (int)OPT_REPLICATE_DO_TABLE:
{
- if(!do_table_inited)
+ if (!do_table_inited)
init_table_rule_hash(&replicate_do_table, &do_table_inited);
if(add_table_rule(&replicate_do_table, optarg))
{
@@ -3121,7 +3165,7 @@ static void get_options(int argc,char **argv)
}
case (int)OPT_REPLICATE_WILD_DO_TABLE:
{
- if(!wild_do_table_inited)
+ if (!wild_do_table_inited)
init_table_rule_array(&replicate_wild_do_table,
&wild_do_table_inited);
if(add_wild_table_rule(&replicate_wild_do_table, optarg))
@@ -3134,7 +3178,7 @@ static void get_options(int argc,char **argv)
}
case (int)OPT_REPLICATE_WILD_IGNORE_TABLE:
{
- if(!wild_ignore_table_inited)
+ if (!wild_ignore_table_inited)
init_table_rule_array(&replicate_wild_ignore_table,
&wild_ignore_table_inited);
if(add_wild_table_rule(&replicate_wild_ignore_table, optarg))
@@ -3147,7 +3191,7 @@ static void get_options(int argc,char **argv)
}
case (int)OPT_REPLICATE_IGNORE_TABLE:
{
- if(!ignore_table_inited)
+ if (!ignore_table_inited)
init_table_rule_hash(&replicate_ignore_table, &ignore_table_inited);
if(add_table_rule(&replicate_ignore_table, optarg))
{
@@ -3347,11 +3391,19 @@ static void get_options(int argc,char **argv)
break;
case OPT_BDB_SKIP:
berkeley_skip=1;
+ have_berkeley_db=SHOW_OPTION_DISABLED;
+ break;
+#endif
+#ifdef HAVE_GEMINI_DB
+ case OPT_GEMINI_SKIP:
+ gemini_skip=1;
+ have_gemini_db=SHOW_OPTION_DISABLED;
break;
#endif
#ifdef HAVE_INNOBASE_DB
case OPT_INNOBASE_SKIP:
innobase_skip=1;
+ have_innobase_db=SHOW_HAVE_DISABLED;
break;
case OPT_INNOBASE_DATA_HOME_DIR:
innobase_data_home_dir=optarg;
@@ -3410,6 +3462,9 @@ static void get_options(int argc,char **argv)
case OPT_MASTER_CONNECT_RETRY:
master_connect_retry= atoi(optarg);
break;
+ case (int) OPT_SAFE_SHOW_DB:
+ opt_safe_show_db=1;
+ break;
default:
fprintf(stderr,"%s: Unrecognized option: %c\n",my_progname,c);
diff --git a/sql/sql_class.h b/sql/sql_class.h
index 67aac31257f..bd295be101c 100644
--- a/sql/sql_class.h
+++ b/sql/sql_class.h
@@ -301,7 +301,7 @@ public:
{
return (transaction.all.bdb_tid != 0 ||
transaction.all.innobase_tid != 0 ||
- transaction.all.gemeni_tid != 0);
+ transaction.all.gemini_tid != 0);
}
inline gptr alloc(unsigned int size) { return alloc_root(&mem_root,size); }
inline gptr calloc(unsigned int size)
diff --git a/sql/sql_show.cc b/sql/sql_show.cc
index b963141f3e3..ed373f58b00 100644
--- a/sql/sql_show.cc
+++ b/sql/sql_show.cc
@@ -75,10 +75,17 @@ mysqld_show_dbs(THD *thd,const char *wild)
List_iterator<char> it(files);
while ((file_name=it++))
{
- thd->packet.length(0);
- net_store_data(&thd->packet,file_name);
- if (my_net_write(&thd->net,(char*) thd->packet.ptr(),thd->packet.length()))
- DBUG_RETURN(-1);
+ if (!opt_safe_show_db || thd->master_access ||
+ acl_get(thd->host, thd->ip, (char*) &thd->remote.sin_addr,
+ thd->priv_user, file_name) ||
+ (grant_option && !check_grant_db(thd, file_name)))
+ {
+ thd->packet.length(0);
+ net_store_data(&thd->packet,file_name);
+ if (my_net_write(&thd->net, (char*) thd->packet.ptr(),
+ thd->packet.length()))
+ DBUG_RETURN(-1);
+ }
}
send_eof(&thd->net);
DBUG_RETURN(0);
@@ -1086,6 +1093,14 @@ int mysqld_show(THD *thd, const char *wild, show_var_st *variables)
case SHOW_INT:
net_store_data(&packet2,(uint32) *(int*) variables[i].value);
break;
+ case SHOW_HAVE:
+ {
+ SHOW_COMP_OPTION tmp= *(SHOW_COMP_OPTION*) variables[i].value;
+ net_store_data(&packet2, (tmp == SHOW_OPTION_NO ? "NO" :
+ tmp == SHOW_OPTION_YES ? "YES" :
+ "DISABLED"));
+ break;
+ }
case SHOW_CHAR:
net_store_data(&packet2,variables[i].value);
break;
diff --git a/sql/sql_table.cc b/sql/sql_table.cc
index 332537cad4e..bdafaf5bddd 100644
--- a/sql/sql_table.cc
+++ b/sql/sql_table.cc
@@ -1426,7 +1426,7 @@ int mysql_alter_table(THD *thd,char *new_db, char *new_name,
{
char path[FN_REFLEN];
(void) sprintf(path,"%s/%s/%s",mysql_data_home,new_db,tmp_name);
- fn_format(path,path,"","",4+16+32);
+ fn_format(path,path,"","",4);
new_table=open_temporary_table(thd, path, new_db, tmp_name,0);
}
if (!new_table)
@@ -1658,7 +1658,8 @@ copy_data_between_tables(TABLE *from,TABLE *to,
};
init_read_record(&info, thd, from, (SQL_SELECT *) 0, 1,1);
- if (handle_duplicates == DUP_IGNORE)
+ if (handle_duplicates == DUP_IGNORE ||
+ handle_duplicates == DUP_REPLACE)
to->file->extra(HA_EXTRA_IGNORE_DUP_KEY);
next_field=to->next_number_field;
while (!(error=info.read_record(&info)))
@@ -1675,7 +1676,8 @@ copy_data_between_tables(TABLE *from,TABLE *to,
copy_ptr->do_copy(copy_ptr);
if ((error=to->file->write_row((byte*) to->record[0])))
{
- if (handle_duplicates != DUP_IGNORE ||
+ if ((handle_duplicates != DUP_IGNORE &&
+ handle_duplicates != DUP_REPLACE) ||
(error != HA_ERR_FOUND_DUPP_KEY &&
error != HA_ERR_FOUND_DUPP_UNIQUE))
{
diff --git a/sql/structs.h b/sql/structs.h
index f1db62f5d9e..36f503312c0 100644
--- a/sql/structs.h
+++ b/sql/structs.h
@@ -125,7 +125,9 @@ typedef struct {
enum SHOW_TYPE { SHOW_LONG,SHOW_CHAR,SHOW_INT,SHOW_CHAR_PTR,SHOW_BOOL,
SHOW_MY_BOOL,SHOW_OPENTABLES,SHOW_STARTTIME,SHOW_QUESTION,
- SHOW_LONG_CONST, SHOW_INT_CONST};
+ SHOW_LONG_CONST, SHOW_INT_CONST, SHOW_HAVE};
+
+enum SHOW_COMP_OPTION { SHOW_OPTION_YES, SHOW_OPTION_NO, SHOW_OPTION_DISABLED};
struct show_var_st {
const char *name;
diff --git a/support-files/mysql.server.sh b/support-files/mysql.server.sh
index 2fe27192762..83618d0124f 100644
--- a/support-files/mysql.server.sh
+++ b/support-files/mysql.server.sh
@@ -137,7 +137,7 @@ case "$mode" in
then echo " done"
fi
# delete lock for RedHat / SuSE
- if test -e /var/lock/subsys/mysql
+ if test -f /var/lock/subsys/mysql
then
rm /var/lock/subsys/mysql
fi