summaryrefslogtreecommitdiff
path: root/mysql-test/t
diff options
context:
space:
mode:
authorunknown <monty@mysql.com>2004-03-16 22:41:30 +0200
committerunknown <monty@mysql.com>2004-03-16 22:41:30 +0200
commitef566cfcaec5fcfdb9ee559141ec7f8475f615b3 (patch)
treeaf285d8080c003d1ecb1479ec43c9b6996fd567f /mysql-test/t
parent7a9dfdb92e3b969da9adee836d852fc76b829237 (diff)
parent5a9910e228bbe380a25aeda7bebea5063c12d648 (diff)
downloadmariadb-git-ef566cfcaec5fcfdb9ee559141ec7f8475f615b3.tar.gz
merge with 4.0
BitKeeper/etc/logging_ok: auto-union VC++Files/innobase/innobase.dsp: Auto merged VC++Files/libmysql/libmysql.dsp: Auto merged acinclude.m4: Auto merged configure.in: Auto merged BitKeeper/deleted/.del-com0shm.c~6a16f0c3d81de1f: Auto merged BitKeeper/deleted/.del-mysql_fix_privilege_tables.sql: Auto merged extra/replace.c: Auto merged include/my_sys.h: Auto merged innobase/btr/btr0btr.c: Auto merged innobase/btr/btr0cur.c: Auto merged innobase/btr/btr0pcur.c: Auto merged innobase/btr/btr0sea.c: Auto merged innobase/configure.in: Auto merged innobase/data/data0data.c: Auto merged innobase/dict/dict0boot.c: Auto merged innobase/dict/dict0crea.c: Auto merged innobase/dict/dict0dict.c: Auto merged innobase/dict/dict0load.c: Auto merged innobase/dict/dict0mem.c: Auto merged innobase/ha/ha0ha.c: Auto merged innobase/ha/hash0hash.c: Auto merged innobase/include/btr0btr.ic: Auto merged innobase/include/data0type.ic: Auto merged innobase/include/dict0mem.h: Auto merged innobase/include/log0log.ic: Auto merged innobase/include/mach0data.ic: Auto merged innobase/include/mtr0log.h: Auto merged innobase/include/mtr0mtr.h: Auto merged innobase/include/os0file.h: Auto merged innobase/include/row0upd.ic: Auto merged innobase/include/srv0srv.h: Auto merged innobase/include/sync0sync.h: Auto merged innobase/include/trx0rseg.ic: Auto merged innobase/lock/lock0lock.c: Auto merged innobase/log/log0recv.c: Auto merged innobase/mem/mem0dbg.c: Auto merged innobase/mtr/mtr0log.c: Auto merged innobase/mtr/mtr0mtr.c: Auto merged innobase/os/os0file.c: Auto merged innobase/page/page0cur.c: Auto merged innobase/page/page0page.c: Auto merged innobase/pars/lexyy.c: Auto merged innobase/read/read0read.c: Auto merged innobase/rem/rem0cmp.c: Auto merged innobase/rem/rem0rec.c: Auto merged innobase/row/row0ins.c: Auto merged innobase/row/row0mysql.c: Auto merged innobase/row/row0purge.c: Auto merged innobase/row/row0sel.c: Auto merged innobase/row/row0undo.c: Auto merged innobase/row/row0upd.c: Auto merged innobase/srv/srv0srv.c: Auto merged innobase/srv/srv0start.c: Auto merged innobase/sync/sync0rw.c: Auto merged innobase/thr/thr0loc.c: Auto merged innobase/trx/trx0purge.c: Auto merged innobase/trx/trx0rec.c: Auto merged innobase/trx/trx0roll.c: Auto merged innobase/trx/trx0trx.c: Auto merged innobase/trx/trx0undo.c: Auto merged myisam/mi_check.c: Auto merged myisam/myisamchk.c: Auto merged mysql-test/r/multi_update.result: Auto merged mysql-test/r/mysqlbinlog.result: Auto merged mysql-test/r/rpl_error_ignored_table.result: Auto merged mysql-test/t/multi_update.test: Auto merged mysql-test/t/rpl_error_ignored_table.test: Auto merged mysys/mf_iocache.c: Auto merged mysys/mf_pack.c: Auto merged mysys/my_getopt.c: Auto merged sql/ha_berkeley.cc: Auto merged sql/ha_myisam.cc: Auto merged sql/lock.cc: Auto merged sql/log.cc: Auto merged sql/opt_range.cc: Auto merged sql/set_var.h: Auto merged sql/sql_cache.cc: Auto merged sql/sql_cache.h: Auto merged sql/sql_delete.cc: Auto merged sql/sql_handler.cc: Auto merged sql/sql_insert.cc: Auto merged sql/sql_list.h: Auto merged sql/sql_select.cc: Auto merged sql/sql_show.cc: Auto merged sql/sql_table.cc: Auto merged sql/sql_update.cc: Auto merged tests/thread_test.c: Auto merged client/mysqldump.c: Keep original indentation mysql-test/r/merge.result: keep old file scripts/mysql_fix_privilege_tables.sh: Keep old structure in merge with 4.0 sql/table.cc: merge with 4.0 + simple optimizations
Diffstat (limited to 'mysql-test/t')
-rw-r--r--mysql-test/t/create.test12
-rw-r--r--mysql-test/t/fulltext.test3
-rw-r--r--mysql-test/t/func_math.test8
-rw-r--r--mysql-test/t/lowercase_table2.test11
-rw-r--r--mysql-test/t/lowercase_table3-master.opt (renamed from mysql-test/t/lowercase_table2-master.opt)0
-rw-r--r--mysql-test/t/lowercase_table3.test37
-rw-r--r--mysql-test/t/multi_update.test37
-rw-r--r--mysql-test/t/query_cache.test17
-rw-r--r--mysql-test/t/reserv/system_mysql_db.test8
-rw-r--r--mysql-test/t/reserv/system_mysql_db_fix-master.opt1
-rw-r--r--mysql-test/t/reserv/system_mysql_db_fix.test14
-rw-r--r--mysql-test/t/reserv/system_mysql_db_refs.test89
-rw-r--r--mysql-test/t/rpl_error_ignored_table-slave.opt2
-rw-r--r--mysql-test/t/rpl_error_ignored_table.test30
-rw-r--r--mysql-test/t/rpl_optimize.test43
15 files changed, 310 insertions, 2 deletions
diff --git a/mysql-test/t/create.test b/mysql-test/t/create.test
index bd629552924..253aa1bd8b9 100644
--- a/mysql-test/t/create.test
+++ b/mysql-test/t/create.test
@@ -220,6 +220,18 @@ select * from t1;
drop table t1;
#
+# Test for Bug #2985
+# "Table truncated when creating another table name with Spaces"
+#
+
+--error 1103
+create table `t1 `(a int);
+--error 1102
+create database `db1 `;
+--error 1166;
+create table t1(`a ` int);
+
+#
# Test create with foreign keys
#
diff --git a/mysql-test/t/fulltext.test b/mysql-test/t/fulltext.test
index 1b56889aec7..50a3d522e3d 100644
--- a/mysql-test/t/fulltext.test
+++ b/mysql-test/t/fulltext.test
@@ -63,6 +63,9 @@ select * from t1 where MATCH a,b AGAINST ('"text search" "now support"' IN BOOL
select * from t1 where MATCH a,b AGAINST ('"text search" -"now support"' IN BOOLEAN MODE);
select * from t1 where MATCH a,b AGAINST ('"text search" +"now support"' IN BOOLEAN MODE);
select * from t1 where MATCH a,b AGAINST ('"text i"' IN BOOLEAN MODE);
+
+select * from t1 where MATCH a,b AGAINST ('+(support collections) +foobar*' IN BOOLEAN MODE);
+select * from t1 where MATCH a,b AGAINST ('+(+(support collections)) +foobar*' IN BOOLEAN MODE);
select * from t1 where MATCH a,b AGAINST ('"xt indexes"' IN BOOLEAN MODE);
# bug#2708 crash
diff --git a/mysql-test/t/func_math.test b/mysql-test/t/func_math.test
index 0f473abb96d..242295f2018 100644
--- a/mysql-test/t/func_math.test
+++ b/mysql-test/t/func_math.test
@@ -40,4 +40,12 @@ SELECT ACOS(0.2*5.0);
SELECT ACOS(0.5*2.0);
SELECT ASIN(0.8+0.2);
SELECT ASIN(1.2-0.2);
+
+#
+# Bug #3051 FLOOR returns invalid
+#
+
+select floor(log(4)/log(2));
+select floor(log(8)/log(2));
+select floor(log(16)/log(2));
explain extended select degrees(pi()),radians(360);
diff --git a/mysql-test/t/lowercase_table2.test b/mysql-test/t/lowercase_table2.test
index 86bb26f0cf9..8f542a7af78 100644
--- a/mysql-test/t/lowercase_table2.test
+++ b/mysql-test/t/lowercase_table2.test
@@ -78,3 +78,14 @@ RENAME TABLE T2 TO T1;
SHOW TABLES LIKE "T1";
SELECT * from T1;
DROP TABLE T1;
+
+#
+# Test problem with temporary tables (Bug #2858)
+#
+
+create table T1 (EVENT_ID int auto_increment primary key, LOCATION char(20));
+insert into T1 values (NULL,"Mic-4"),(NULL,"Mic-5"),(NULL,"Mic-6");
+SELECT LOCATION FROM T1 WHERE EVENT_ID=2 UNION ALL SELECT LOCATION FROM T1 WHERE EVENT_ID=3;
+SELECT LOCATION FROM T1 WHERE EVENT_ID=2 UNION ALL SELECT LOCATION FROM T1 WHERE EVENT_ID=3;
+SELECT LOCATION FROM T1 WHERE EVENT_ID=2 UNION ALL SELECT LOCATION FROM T1 WHERE EVENT_ID=3;
+drop table T1;
diff --git a/mysql-test/t/lowercase_table2-master.opt b/mysql-test/t/lowercase_table3-master.opt
index 9b27aef9bf8..9b27aef9bf8 100644
--- a/mysql-test/t/lowercase_table2-master.opt
+++ b/mysql-test/t/lowercase_table3-master.opt
diff --git a/mysql-test/t/lowercase_table3.test b/mysql-test/t/lowercase_table3.test
new file mode 100644
index 00000000000..735a0b390f9
--- /dev/null
+++ b/mysql-test/t/lowercase_table3.test
@@ -0,0 +1,37 @@
+#
+# Test of force of lower-case-table-names=0
+# (User has case insensitive file system and want's to preserve case of
+# table names)
+#
+
+--source include/have_innodb.inc
+--require r/lowercase0.require
+disable_query_log;
+show variables like "lower_case_%";
+--require r/true.require
+select @@version_compile_os NOT IN ("NT","WIN2000","Win95/Win98","XP") as "TRUE";
+enable_query_log;
+
+--disable_warnings
+DROP TABLE IF EXISTS t1,T1;
+--enable_warnings
+
+#
+# This is actually an error, but ok as the user has forced this
+# by using --lower-case-table-names=0
+
+CREATE TABLE t1 (a int);
+SELECT * from T1;
+drop table t1;
+flush tables;
+
+#
+# InnoDB should in this case be case sensitive
+# Note that this is not true on windows as no this OS, InnoDB is always
+# storing things in lower case.
+#
+
+CREATE TABLE t1 (a int) type=INNODB;
+--error 1016
+SELECT * from T1;
+drop table t1;
diff --git a/mysql-test/t/multi_update.test b/mysql-test/t/multi_update.test
index eb77734300f..6cb4a107bdb 100644
--- a/mysql-test/t/multi_update.test
+++ b/mysql-test/t/multi_update.test
@@ -344,3 +344,40 @@ select 't2 rows after big delete', count(*) from t2;
select 't1 rows after big delete', count(*) from t1;
drop table t1,t2;
+
+#
+# Test alias (this is not correct in 4.0)
+#
+
+CREATE TABLE t1 ( a int );
+CREATE TABLE t2 ( a int );
+DELETE t1 FROM t1, t2 AS t3;
+--error 1066
+DELETE t4 FROM t1, t1 AS t4;
+--error 1066
+DELETE t3 FROM t1 AS t3, t1 AS t4;
+#--error 1066
+DELETE t1 FROM t1 AS t3, t2 AS t4;
+INSERT INTO t1 values (1),(2);
+INSERT INTO t2 values (1),(2);
+DELETE t1 FROM t1 AS t2, t2 AS t1 where t1.a=t2.a and t1.a=1;
+SELECT * from t1;
+SELECT * from t2;
+DELETE t2 FROM t1 AS t2, t2 AS t1 where t1.a=t2.a and t1.a=2;
+SELECT * from t1;
+SELECT * from t2;
+DROP TABLE t1,t2;
+
+#
+# Test update with const tables
+#
+
+create table `t1` (`p_id` int(10) unsigned NOT NULL auto_increment, `p_code` varchar(20) NOT NULL default '', `p_active` tinyint(1) unsigned NOT NULL default '1', PRIMARY KEY (`p_id`) );
+create table `t2` (`c2_id` int(10) unsigned NULL auto_increment, `c2_p_id` int(10) unsigned NOT NULL default '0', `c2_note` text NOT NULL, `c2_active` tinyint(1) unsigned NOT NULL default '1', PRIMARY KEY (`c2_id`), KEY `c2_p_id` (`c2_p_id`) );
+insert into t1 values (0,'A01-Comp',1);
+insert into t1 values (0,'B01-Comp',1);
+insert into t2 values (0,1,'A Note',1);
+update t1 left join t2 on p_id = c2_p_id set c2_note = 'asdf-1' where p_id = 2;
+select * from t1;
+select * from t2;
+drop table t1, t2;
diff --git a/mysql-test/t/query_cache.test b/mysql-test/t/query_cache.test
index 5ae2039138d..31aa69e32ec 100644
--- a/mysql-test/t/query_cache.test
+++ b/mysql-test/t/query_cache.test
@@ -544,10 +544,25 @@ select * from t3;
enable_result_log;
delete from t4 where a=1;
flush query cache;
-
drop table t1,t2,t3,t4;
#
+# WRITE LOCK & QC
+#
+set query_cache_wlock_invalidate=1;
+create table t1 (a int not null);
+create table t2 (a int not null);
+select * from t1;
+select * from t2;
+show status like "Qcache_queries_in_cache";
+lock table t1 write, t2 read;
+show status like "Qcache_queries_in_cache";
+unlock table;
+drop table t1,t2;
+set query_cache_wlock_invalidate=default;
+
+
+#
# Test character set related variables:
# character_set_result
# character_set_client
diff --git a/mysql-test/t/reserv/system_mysql_db.test b/mysql-test/t/reserv/system_mysql_db.test
new file mode 100644
index 00000000000..85a2f7f9bae
--- /dev/null
+++ b/mysql-test/t/reserv/system_mysql_db.test
@@ -0,0 +1,8 @@
+#
+# This test must examine integrity of system database "mysql"
+#
+
+-- disable_query_log
+use mysql;
+-- enable_query_log
+-- source include/system_db_struct.inc
diff --git a/mysql-test/t/reserv/system_mysql_db_fix-master.opt b/mysql-test/t/reserv/system_mysql_db_fix-master.opt
new file mode 100644
index 00000000000..69eb9d2cbf0
--- /dev/null
+++ b/mysql-test/t/reserv/system_mysql_db_fix-master.opt
@@ -0,0 +1 @@
+--result-file=system_mysql_db \ No newline at end of file
diff --git a/mysql-test/t/reserv/system_mysql_db_fix.test b/mysql-test/t/reserv/system_mysql_db_fix.test
new file mode 100644
index 00000000000..bb2d37ee215
--- /dev/null
+++ b/mysql-test/t/reserv/system_mysql_db_fix.test
@@ -0,0 +1,14 @@
+#
+# This is the test for mysql_fix_privilege_tables
+#
+
+-- disable_query_log
+-- source include/create_old_system_tables.inc
+-- exec $MYSQL_FIX_SYSTEM_TABLES --database=test > nil 2>nil
+-- enable_query_log
+
+-- source include/system_db_struct.inc
+
+-- disable_query_log
+-- source include/drop_system_tables.inc
+-- enable_query_log
diff --git a/mysql-test/t/reserv/system_mysql_db_refs.test b/mysql-test/t/reserv/system_mysql_db_refs.test
new file mode 100644
index 00000000000..d15141fdaa5
--- /dev/null
+++ b/mysql-test/t/reserv/system_mysql_db_refs.test
@@ -0,0 +1,89 @@
+#
+# This test must examine integrity of current system database
+#
+
+set @name="This is a very long string, that mustn't find room in a system field like Table_name. Thus it should be cut by the actual size of the field. So we can use this string to find out the actual length of the field and to use it in any compare queries";
+
+#
+# If this part is wrong, most likely you've done wrong modification of system database "mysql"
+#
+
+create table test_db select * from mysql.db;
+delete from test_db;
+insert into test_db (Host,Db,User) values (@name,@name,@name);
+
+create table test_host select * from mysql.host;
+delete from test_host;
+insert into test_host (Host,Db) values (@name,@name);
+
+create table test_user select * from mysql.user;
+delete from test_user;
+insert into test_user (Host,User) values (@name,@name);
+
+create table test_func select * from mysql.func;
+delete from test_func;
+insert into test_func (name) values (@name);
+
+create table test_tables_priv select * from mysql.tables_priv;
+delete from test_tables_priv;
+insert into test_tables_priv (Host,Db,User,Table_name) values (@name,@name,@name,@name);
+
+create table test_columns_priv select * from mysql.columns_priv;
+delete from test_columns_priv;
+insert into test_columns_priv (Host,Db,User,Table_name,Column_name) values (@name,@name,@name,@name,@name);
+
+# 'Host' field must be the same for all the tables:
+
+select
+ if(isnull(test_db.Host),'WRONG!!!','ok') as test_db_Host,
+ if(isnull(test_host.Host),'WRONG!!!','ok') as test_host_Host,
+ if(isnull(test_user.Host),'WRONG!!!','ok') as test_user_Host,
+ if(isnull(test_tables_priv.Host),'WRONG!!!','ok') as test_tables_priv_Host,
+ if(isnull(test_columns_priv.Host),'WRONG!!!','ok') as test_columns_priv_Host
+
+from test_db
+left join test_host on test_db.Host=test_host.Host
+left join test_user on test_db.Host=test_user.Host
+left join test_tables_priv on test_db.Host=test_tables_priv.Host
+left join test_columns_priv on test_db.Host=test_columns_priv.Host;
+
+# 'Db' field must be the same for all the tables:
+
+select
+ if(isnull(test_db.Db),'WRONG!!!','ok') as test_db_Db,
+ if(isnull(test_host.Db),'WRONG!!!','ok') as test_host_Db,
+ if(isnull(test_tables_priv.Db),'WRONG!!!','ok') as test_tables_priv_Db,
+ if(isnull(test_columns_priv.Db),'WRONG!!!','ok') as est_columns_priv_Db
+
+from test_db
+left join test_host on test_db.Db=test_host.Db
+left join test_tables_priv on test_db.Db=test_tables_priv.Db
+left join test_columns_priv on test_db.Db=test_columns_priv.Db;
+
+# 'User' field must be the same for all the tables:
+
+select
+ if(isnull(test_db.User),'WRONG!!!','ok') as test_db_User,
+ if(isnull(test_user.User),'WRONG!!!','ok') as test_user_User,
+ if(isnull(test_tables_priv.User),'WRONG!!!','ok') as test_tables_priv_User,
+ if(isnull(test_columns_priv.User),'WRONG!!!','ok') as test_columns_priv_User
+
+from test_db
+left join test_user on test_db.User=test_user.User
+left join test_tables_priv on test_db.User=test_tables_priv.User
+left join test_columns_priv on test_db.User=test_columns_priv.User;
+
+# 'Table_name' field must be the same for all the tables:
+
+select
+ if(isnull(test_tables_priv.User),'WRONG!!!','ok') as test_tables_priv_User,
+ if(isnull(test_columns_priv.User),'WRONG!!!','ok') as test_columns_priv_User
+from test_tables_priv
+left join test_columns_priv on test_tables_priv.Table_name=test_columns_priv.Table_name;
+
+drop table test_columns_priv;
+drop table test_tables_priv;
+drop table test_func;
+drop table test_host;
+drop table test_user;
+drop table test_db;
diff --git a/mysql-test/t/rpl_error_ignored_table-slave.opt b/mysql-test/t/rpl_error_ignored_table-slave.opt
index 0d3485f9e25..cb49119bfcb 100644
--- a/mysql-test/t/rpl_error_ignored_table-slave.opt
+++ b/mysql-test/t/rpl_error_ignored_table-slave.opt
@@ -1 +1 @@
---replicate-ignore-table=test.t1
+--replicate-ignore-table=test.t1 --replicate-ignore-table=test.t2 --replicate-ignore-table=test.t3
diff --git a/mysql-test/t/rpl_error_ignored_table.test b/mysql-test/t/rpl_error_ignored_table.test
index aacdb506107..f6d9ffa8125 100644
--- a/mysql-test/t/rpl_error_ignored_table.test
+++ b/mysql-test/t/rpl_error_ignored_table.test
@@ -24,3 +24,33 @@ drop table t1;
save_master_pos;
connection slave;
sync_with_master;
+
+# Now test that even critical errors (connection killed)
+# are ignored if rules allow it.
+# The "kill" idea was copied from rpl000001.test.
+
+connection master1;
+select get_lock('crash_lock%20C', 10);
+
+connection master;
+create table t2 (a int primary key);
+insert into t2 values(1);
+create table t3 (id int);
+insert into t3 values(connection_id());
+send update t2 set a = a + 1 + get_lock('crash_lock%20C', 10);
+
+connection master1;
+sleep 2;
+select (@id := id) - id from t3;
+kill @id;
+drop table t2,t3;
+connection master;
+--error 1053;
+reap;
+connection master1;
+show binlog events from 79;
+save_master_pos;
+connection slave;
+# SQL slave thread should not have stopped (because table of the killed
+# query is in the ignore list).
+sync_with_master;
diff --git a/mysql-test/t/rpl_optimize.test b/mysql-test/t/rpl_optimize.test
new file mode 100644
index 00000000000..9f02b715885
--- /dev/null
+++ b/mysql-test/t/rpl_optimize.test
@@ -0,0 +1,43 @@
+# Test for BUG#1858 "OPTIMIZE TABLE done by a client
+# thread stops the slave SQL thread".
+# You can replace OPTIMIZE by REPAIR.
+
+source include/master-slave.inc;
+
+create table t1 (a int not null auto_increment primary key, b int, key(b));
+INSERT INTO t1 (a) VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
+INSERT INTO t1 (a) SELECT null FROM t1;
+INSERT INTO t1 (a) SELECT null FROM t1;
+INSERT INTO t1 (a) SELECT null FROM t1;
+INSERT INTO t1 (a) SELECT null FROM t1;
+INSERT INTO t1 (a) SELECT null FROM t1;
+INSERT INTO t1 (a) SELECT null FROM t1;
+INSERT INTO t1 (a) SELECT null FROM t1;
+INSERT INTO t1 (a) SELECT null FROM t1;
+INSERT INTO t1 (a) SELECT null FROM t1;
+INSERT INTO t1 (a) SELECT null FROM t1;
+INSERT INTO t1 (a) SELECT null FROM t1;
+INSERT INTO t1 (a) SELECT null FROM t1;
+INSERT INTO t1 (a) SELECT null FROM t1;
+save_master_pos;
+# a few updates to force OPTIMIZE to do something
+update t1 set b=(a/2*rand());
+delete from t1 order by b limit 10000;
+
+connection slave;
+sync_with_master;
+optimize table t1;
+connection master;
+save_master_pos;
+connection slave;
+# Bug was that when the INSERT terminated on slave,
+# the slave SQL thread got killed by OPTIMIZE.
+sync_with_master; # won't work if slave SQL thread stopped
+
+connection master; # cleanup
+drop table t1;
+connection slave;
+sync_with_master;
+
+# If the machine is so fast that slave syncs before OPTIMIZE
+# starts, this test wil demonstrate nothing but will pass.