summaryrefslogtreecommitdiff
path: root/mysql-test/t
diff options
context:
space:
mode:
Diffstat (limited to 'mysql-test/t')
-rw-r--r--mysql-test/t/bdb.test27
-rw-r--r--mysql-test/t/group_by.test12
-rw-r--r--mysql-test/t/innodb.test47
-rw-r--r--mysql-test/t/lock.test32
-rw-r--r--mysql-test/t/rpl000014.test5
-rw-r--r--mysql-test/t/rpl000015.test4
-rw-r--r--mysql-test/t/rpl000016.test4
-rwxr-xr-xmysql-test/t/rpl000018-master.sh6
-rw-r--r--mysql-test/t/show_check.test17
-rw-r--r--mysql-test/t/shw000001.test8
10 files changed, 148 insertions, 14 deletions
diff --git a/mysql-test/t/bdb.test b/mysql-test/t/bdb.test
index 564491fc520..96296e238fd 100644
--- a/mysql-test/t/bdb.test
+++ b/mysql-test/t/bdb.test
@@ -678,3 +678,30 @@ CREATE TABLE t1 (
INSERT INTO t1 VALUES (1, 1);
SELECT MIN(B),MAX(b) FROM t1 WHERE t1.a = 1;
drop table t1;
+
+#
+# Test problem with BDB and lock tables with duplicate write.
+#
+
+create table t1 (id int NOT NULL,id2 int NOT NULL,id3 int NOT NULL,dummy1 char(30),primary key (id,id2),index index_id3 (id3)) type=bdb;
+insert into t1 values (0,0,0,'ABCDEFGHIJ'),(2,2,2,'BCDEFGHIJK'),(1,1,1,'CDEFGHIJKL');
+LOCK TABLES t1 WRITE;
+--error 690
+insert into t1 values (99,1,2,'D'),(1,1,2,'D');
+select id from t1;
+select id from t1;
+UNLOCK TABLES;
+DROP TABLE t1;
+
+create table t1 (id int NOT NULL,id2 int NOT NULL,id3 int NOT NULL,dummy1 char(30),primary key (id,id2),index index_id3 (id3)) type=bdb;
+insert into t1 values (0,0,0,'ABCDEFGHIJ'),(2,2,2,'BCDEFGHIJK'),(1,1,1,'CDEFGHIJKL');
+LOCK TABLES t1 WRITE;
+begin;
+--error 690
+insert into t1 values (99,1,2,'D'),(1,1,2,'D');
+select id from t1;
+insert ignore into t1 values (100,1,2,'D'),(1,1,99,'D');
+commit;
+select id,id3 from t1;
+UNLOCK TABLES;
+DROP TABLE t1;
diff --git a/mysql-test/t/group_by.test b/mysql-test/t/group_by.test
index edd3c1fff7e..e75841dc6d0 100644
--- a/mysql-test/t/group_by.test
+++ b/mysql-test/t/group_by.test
@@ -2,6 +2,7 @@
# Test of group (Failed for Lars Hoss <lh@pbm.de>)
#
+drop table if exists t1,t2;
CREATE TABLE t1 (
spID int(10) unsigned,
userID int(10) unsigned,
@@ -208,3 +209,14 @@ select value,description,bug_id from t2 left join t1 on t2.program=t1.product an
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;
+
+#
+# Problem with functions and group functions when no matching rows
+#
+
+create table t1 (foo int);
+insert into t1 values (1);
+select 1+1, "a",count(*) from t1 where foo in (2);
+insert into t1 values (1);
+select 1+1,"a",count(*) from t1 where foo in (2);
+drop table t1;
diff --git a/mysql-test/t/innodb.test b/mysql-test/t/innodb.test
index b18091656b6..cef53ce8165 100644
--- a/mysql-test/t/innodb.test
+++ b/mysql-test/t/innodb.test
@@ -429,3 +429,50 @@ create table t1 (a int primary key,b int, c int, d int, e int, f int, g int, h
insert into t1 values (1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1);
explain select * from t1 where a > 0 and a < 50;
drop table t1;
+
+#
+# Test lock tables
+#
+
+create table t1 (id int NOT NULL,id2 int NOT NULL,id3 int NOT NULL,dummy1 char(30),primary key (id,id2),index index_id3 (id3)) type=innodb;
+insert into t1 values (0,0,0,'ABCDEFGHIJ'),(2,2,2,'BCDEFGHIJK'),(1,1,1,'CDEFGHIJKL');
+LOCK TABLES t1 WRITE;
+--error 690
+insert into t1 values (99,1,2,'D'),(1,1,2,'D');
+select id from t1;
+select id from t1;
+UNLOCK TABLES;
+DROP TABLE t1;
+
+create table t1 (id int NOT NULL,id2 int NOT NULL,id3 int NOT NULL,dummy1 char(30),primary key (id,id2),index index_id3 (id3)) type=innodb;
+insert into t1 values (0,0,0,'ABCDEFGHIJ'),(2,2,2,'BCDEFGHIJK'),(1,1,1,'CDEFGHIJKL');
+LOCK TABLES t1 WRITE;
+begin;
+--error 690
+insert into t1 values (99,1,2,'D'),(1,1,2,'D');
+select id from t1;
+insert ignore into t1 values (100,1,2,'D'),(1,1,99,'D');
+commit;
+select id,id3 from t1;
+UNLOCK TABLES;
+DROP TABLE t1;
+
+#
+# Test prefix key
+#
+--error 1089
+create table t1 (a char(20), unique (a(5))) type=innodb;
+create table t1 (a char(20), index (a(5))) type=innodb;
+show create table t1;
+drop table t1;
+
+#
+# Test using temporary table and auto_increment
+#
+
+create temporary table t1 (a int not null auto_increment, primary key(a)) type=innodb;
+insert into t1 values (NULL),(NULL),(NULL);
+delete from t1 where a=3;
+insert into t1 values (NULL);
+select * from t1;
+drop table t1;
diff --git a/mysql-test/t/lock.test b/mysql-test/t/lock.test
index 777129ec814..385713174d2 100644
--- a/mysql-test/t/lock.test
+++ b/mysql-test/t/lock.test
@@ -21,3 +21,35 @@ LOCK TABLE t1 WRITE,t2 write;
insert into t2 SELECT * from t1;
update t1 set id=1 where id=-1;
drop table t1,t2;
+
+
+#
+# Check bug with INSERT ... SELECT with lock tables
+#
+
+CREATE TABLE t1 (
+ index1 smallint(6) default NULL,
+ nr smallint(6) default NULL,
+ KEY index1(index1)
+) TYPE=MyISAM;
+
+CREATE TABLE t2 (
+ nr smallint(6) default NULL,
+ name varchar(20) default NULL
+) TYPE=MyISAM;
+
+INSERT INTO t2 VALUES (1,'item1');
+INSERT INTO t2 VALUES (2,'item2');
+
+# problem begins here!
+lock tables t1 write, t2 read;
+insert into t1 select 1,nr from t2 where name='item1';
+insert into t1 select 2,nr from t2 where name='item2';
+unlock tables;
+check table t1;
+
+# Check error message
+lock tables t1 write;
+check table t2;
+unlock tables;
+drop table t1,t2;
diff --git a/mysql-test/t/rpl000014.test b/mysql-test/t/rpl000014.test
index 34e160a760c..b501d63b10e 100644
--- a/mysql-test/t/rpl000014.test
+++ b/mysql-test/t/rpl000014.test
@@ -1,18 +1,21 @@
source include/master-slave.inc;
-source include/have_default_master.inc;
connection master;
show master status;
save_master_pos;
connection slave;
sync_with_master;
+--replace_result 9306 9999 3334 9999 3335 9999
show slave status;
change master to master_log_pos=73;
slave stop;
change master to master_log_pos=73;
+--replace_result 9306 9999 3334 9999 3335 9999
show slave status;
slave start;
+--replace_result 9306 9999 3334 9999 3335 9999
show slave status;
change master to master_log_pos=173;
+--replace_result 9306 9999 3334 9999 3335 9999
show slave status;
connection master;
show master status;
diff --git a/mysql-test/t/rpl000015.test b/mysql-test/t/rpl000015.test
index 825d1317bbc..73a10bed7b3 100644
--- a/mysql-test/t/rpl000015.test
+++ b/mysql-test/t/rpl000015.test
@@ -1,6 +1,5 @@
connect (master,localhost,root,,test,0,mysql-master.sock);
connect (slave,localhost,root,,test,0, mysql-slave.sock);
-source include/have_default_master.inc;
connection master;
reset master;
show master status;
@@ -9,12 +8,15 @@ connection slave;
reset slave;
show slave status;
change master to master_host='127.0.0.1';
+--replace_result 3306 9998 9306 9999 3334 9999 3335 9999
show slave status;
eval change master to master_host='127.0.0.1',master_user='root',
master_password='',master_port=$MASTER_MYPORT;
+--replace_result 9306 9999 3334 9999 3335 9999
show slave status;
slave start;
sync_with_master;
+--replace_result 9306 9999 3334 9999 3335 9999
show slave status;
connection master;
drop table if exists t1;
diff --git a/mysql-test/t/rpl000016.test b/mysql-test/t/rpl000016.test
index a1450089898..7b46bc75498 100644
--- a/mysql-test/t/rpl000016.test
+++ b/mysql-test/t/rpl000016.test
@@ -1,6 +1,5 @@
connect (master,localhost,root,,test,0,mysql-master.sock);
connect (slave,localhost,root,,test,0,mysql-slave.sock);
-source include/have_default_master.inc;
system cat /dev/null > var/slave-data/master.info;
system chmod 000 var/slave-data/master.info;
connection slave;
@@ -23,6 +22,7 @@ insert into t1 values('Could not break slave'),('Tried hard');
save_master_pos;
connection slave;
sync_with_master;
+--replace_result 9306 9999 3334 9999 3335 9999
show slave status;
select * from t1;
connection master;
@@ -68,6 +68,7 @@ insert into t2 values (65);
save_master_pos;
connection slave;
sync_with_master;
+--replace_result 9306 9999 3334 9999 3335 9999
show slave status;
select * from t2;
connection master;
@@ -87,6 +88,7 @@ connection slave;
slave stop;
slave start;
sync_with_master;
+--replace_result 9306 9999 3334 9999 3335 9999
show slave status;
# because of concurrent insert, the table may not be up to date
# if we do not lock
diff --git a/mysql-test/t/rpl000018-master.sh b/mysql-test/t/rpl000018-master.sh
index 71f0f12d0c5..e570f106ec6 100755
--- a/mysql-test/t/rpl000018-master.sh
+++ b/mysql-test/t/rpl000018-master.sh
@@ -1,3 +1,3 @@
-rm -f $MYSQL_TEST_DIR/var/lib/master-bin.*
-cp $MYSQL_TEST_DIR/std_data/master-bin.001 $MYSQL_TEST_DIR/var/lib/
-echo ./master-bin.001 > $MYSQL_TEST_DIR/var/lib/master-bin.index
+rm -f $MYSQL_TEST_DIR/var/master-data/master-bin.*
+cp $MYSQL_TEST_DIR/std_data/master-bin.001 $MYSQL_TEST_DIR/var/master-data/
+echo ./master-bin.001 > $MYSQL_TEST_DIR/var/master-data/master-bin.index
diff --git a/mysql-test/t/show_check.test b/mysql-test/t/show_check.test
index d4be1a6d25a..f4f58c8c885 100644
--- a/mysql-test/t/show_check.test
+++ b/mysql-test/t/show_check.test
@@ -48,3 +48,20 @@ show index from t1;
repair table t1;
show index from t1;
drop table t1;
+
+#
+# Test of SHOW CREATE
+#
+
+create temporary table t1 (a int not null);
+show create table t1;
+alter table t1 rename t2;
+show create table t2;
+drop table t2;
+
+create table t1 (
+ test_set set( 'val1', 'val2', 'val3' ) not null default '',
+ name char(20) default 'O''Brien'
+ ) comment = 'it\'s a table' ;
+show create table t1 ;
+drop table t1;
diff --git a/mysql-test/t/shw000001.test b/mysql-test/t/shw000001.test
deleted file mode 100644
index 6b24d8a44c7..00000000000
--- a/mysql-test/t/shw000001.test
+++ /dev/null
@@ -1,8 +0,0 @@
-use test;
-drop table if exists t1;
-create table t1 (
- test_set set( 'val1', 'val2', 'val3' ) not null default '',
- name char(20) default 'O''Brien'
- ) comment = 'it\'s a table' ;
-show create table t1 ;
-drop table t1;