diff options
Diffstat (limited to 'mysql-test/t')
-rwxr-xr-x | mysql-test/t/backup-master.sh | 5 | ||||
-rw-r--r-- | mysql-test/t/backup.test | 32 | ||||
-rw-r--r-- | mysql-test/t/delete.test | 20 | ||||
-rw-r--r-- | mysql-test/t/join.test | 24 | ||||
-rw-r--r-- | mysql-test/t/type_datetime.test | 5 |
5 files changed, 74 insertions, 12 deletions
diff --git a/mysql-test/t/backup-master.sh b/mysql-test/t/backup-master.sh new file mode 100755 index 00000000000..99da5857afe --- /dev/null +++ b/mysql-test/t/backup-master.sh @@ -0,0 +1,5 @@ +#!/bin/sh +if [ "$MYSQL_TEST_DIR" ] +then + rm -f $MYSQL_TEST_DIR/var/tmp/*.frm $MYSQL_TEST_DIR/var/tmp/*.MY? +fi diff --git a/mysql-test/t/backup.test b/mysql-test/t/backup.test index 55fe140850d..0346e6ba456 100644 --- a/mysql-test/t/backup.test +++ b/mysql-test/t/backup.test @@ -1,15 +1,22 @@ +# +# This test is a bit tricky as we can't use backup table to overwrite an old +# table +# connect (con1,localhost,root,,); connect (con2,localhost,root,,); connection con1; set SQL_LOG_BIN=0; -drop table if exists t1; +create table t4(n int); +--replace_result "errno: 2" "errno: X" "errno: 22" "errno: X" "errno: 23" "errno: X" +backup table t4 to '../bogus'; +backup table t4 to '../tmp'; +--replace_result "errno: 17" "errno: X" +backup table t4 to '../tmp'; +drop table t4; +restore table t4 from '../tmp'; +select count(*) from t4; + create table t1(n int); ---replace_result "errno = 1" "errno = X" "errno = 2" "errno = X" "errno = 22" "errno = X" "errno = 23" "errno = X" -backup table t1 to '../bogus'; -backup table t1 to '../tmp'; -drop table t1; -restore table t1 from '../tmp'; -select count(*) from t1; insert into t1 values (23),(45),(67); backup table t1 to '../tmp'; drop table t1; @@ -20,23 +27,24 @@ create table t2(m int not null primary key); create table t3(k int not null primary key); insert into t2 values (123),(145),(167); insert into t3 values (223),(245),(267); -backup table t1,t2,t3 to '../tmp'; +backup table t2,t3 to '../tmp'; drop table t1,t2,t3; restore table t1,t2,t3 from '../tmp'; select n from t1; select m from t2; select k from t3; -drop table t1,t2,t3; +drop table t1,t2,t3,t4; restore table t1 from '../tmp'; connection con2; +rename table t1 to t5; --send -lock tables t1 write; +lock tables t5 write; connection con1; --send -backup table t1 to '../tmp'; +backup table t5 to '../tmp'; connection con2; reap; unlock tables; connection con1; reap; -drop table t1; +drop table t5; diff --git a/mysql-test/t/delete.test b/mysql-test/t/delete.test index 953e22cdd55..13fa617b3cf 100644 --- a/mysql-test/t/delete.test +++ b/mysql-test/t/delete.test @@ -35,3 +35,23 @@ 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; + +# +# CHAR(0) bug - not actually DELETE bug, but anyway... +# + +CREATE TABLE t1 ( + bool char(0) default NULL, + not_null varchar(20) binary NOT NULL default '', + misc integer not null, + PRIMARY KEY (not_null) +) TYPE=MyISAM; + +INSERT INTO t1 VALUES (NULL,'a',4), (NULL,'b',5), (NULL,'c',6), (NULL,'d',7); + +select * from t1 where misc > 5 and bool is null; +delete from t1 where misc > 5 and bool is null; +select * from t1 where misc > 5 and bool is null; + +drop table t1; + diff --git a/mysql-test/t/join.test b/mysql-test/t/join.test index 70980f656ab..63ec90f854c 100644 --- a/mysql-test/t/join.test +++ b/mysql-test/t/join.test @@ -247,3 +247,27 @@ CREATE TABLE t2 ( INSERT INTO t2 VALUES (1,'s1'),(2,'s2'),(3,'s3'),(4,'s4'),(5,'s5'); select t1.*, t2.* from t1, t2 where t2.id=t1.t2_id limit 2; drop table t1,t2; + +# +# Bug in range optimiser with MAYBE_KEY +# + +CREATE TABLE t1 ( + siteid varchar(25) NOT NULL default '', + emp_id varchar(30) NOT NULL default '', + rate_code varchar(10) default NULL, + UNIQUE KEY site_emp (siteid,emp_id), + KEY siteid (siteid) +) TYPE=MyISAM; +INSERT INTO t1 VALUES ('rivercats','psmith','cust'), ('rivercats','KWalker','cust'); +CREATE TABLE t2 ( + siteid varchar(25) NOT NULL default '', + rate_code varchar(10) NOT NULL default '', + base_rate float NOT NULL default '0', + PRIMARY KEY (siteid,rate_code), + FULLTEXT KEY rate_code (rate_code) +) TYPE=MyISAM; +INSERT INTO t2 VALUES ('rivercats','cust',20); +SELECT emp.rate_code, lr.base_rate FROM t1 AS emp LEFT JOIN t2 AS lr USING (siteid, rate_code) WHERE emp.emp_id = 'psmith' AND lr.siteid = 'rivercats'; +SELECT emp.rate_code, lr.base_rate FROM t1 AS emp LEFT JOIN t2 AS lr USING (siteid, rate_code) WHERE lr.siteid = 'rivercats' AND emp.emp_id = 'psmith'; +drop table t1,t2; diff --git a/mysql-test/t/type_datetime.test b/mysql-test/t/type_datetime.test index a516bc89f99..f5103958979 100644 --- a/mysql-test/t/type_datetime.test +++ b/mysql-test/t/type_datetime.test @@ -59,3 +59,8 @@ INSERT INTO t1 (numfacture,expedition) VALUES ('1212','0001-00-00 00:00:00'); SELECT * FROM t1 WHERE expedition='0001-00-00 00:00:00'; EXPLAIN SELECT * FROM t1 WHERE expedition='0001-00-00 00:00:00'; drop table t1; +create table t1 (a datetime not null, b datetime not null); +insert into t1 values (now(), now()); +insert into t1 values (now(), now()); +select * from t1 where a is null or b is null; +drop table t1; |