summaryrefslogtreecommitdiff
path: root/mysql-test
diff options
context:
space:
mode:
Diffstat (limited to 'mysql-test')
-rw-r--r--mysql-test/mysql-test-run.sh2
-rw-r--r--mysql-test/r/group_by.result14
-rw-r--r--mysql-test/r/merge.result4
-rw-r--r--mysql-test/r/null.result36
-rw-r--r--mysql-test/r/rpl_loaddata.result13
-rw-r--r--mysql-test/std_data/rpl_loaddata.dat2
-rw-r--r--mysql-test/t/group_by.test11
-rw-r--r--mysql-test/t/merge.test2
-rw-r--r--mysql-test/t/null.test31
-rw-r--r--mysql-test/t/rpl_loaddata.test16
-rw-r--r--mysql-test/t/rpl_log-master.opt1
11 files changed, 128 insertions, 4 deletions
diff --git a/mysql-test/mysql-test-run.sh b/mysql-test/mysql-test-run.sh
index edd573f50a3..1d730e3f7c5 100644
--- a/mysql-test/mysql-test-run.sh
+++ b/mysql-test/mysql-test-run.sh
@@ -332,7 +332,7 @@ while test $# -gt 0; do
VALGRIND="valgrind --alignment=8 --leak-check=yes"
EXTRA_MASTER_MYSQLD_OPT="$EXTRA_MASTER_MYSQLD_OPT --skip-safemalloc"
EXTRA_SLAVE_MYSQLD_OPT="$EXTRA_SLAVE_MYSQLD_OPT --skip-safemalloc"
- #SLEEP_TIME_AFTER_RESTART=120
+ SLEEP_TIME_AFTER_RESTART=10
SLEEP_TIME_FOR_DELETE=60
;;
--valgrind-options=*)
diff --git a/mysql-test/r/group_by.result b/mysql-test/r/group_by.result
index aa3de48c09e..a63054da88b 100644
--- a/mysql-test/r/group_by.result
+++ b/mysql-test/r/group_by.result
@@ -468,3 +468,17 @@ NOT NULL);
max(value)
4
drop table t1,t2,t3;
+create table t1 (a blob null);
+insert into t1 values (NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(""),(""),(""),("b");
+select a,count(*) from t1 group by a;
+a count(*)
+NULL 9
+ 3
+b 1
+set option sql_big_tables=1;
+select a,count(*) from t1 group by a;
+a count(*)
+NULL 9
+ 3
+b 1
+drop table t1;
diff --git a/mysql-test/r/merge.result b/mysql-test/r/merge.result
index 9199f291c08..b28607218d1 100644
--- a/mysql-test/r/merge.result
+++ b/mysql-test/r/merge.result
@@ -260,7 +260,7 @@ t3 CREATE TABLE `t3` (
`othr` int(11) NOT NULL default '0'
) TYPE=MRG_MyISAM CHARSET=latin1 UNION=(t1,t2)
drop table t3,t2,t1;
-create table t1 (a int not null) type=merge;
+create table t1 (a int not null, key(a)) type=merge;
select * from t1;
a
drop table t1;
@@ -536,7 +536,7 @@ INSERT INTO t2 VALUES (1,2), (2,2);
CREATE TABLE t3 ( a int(11) NOT NULL default '0', b int(11) NOT NULL default '0', KEY a (a,b)) TYPE=MRG_MyISAM UNION=(t1,t2);
select max(b) from t3 where a = 2;
max(b)
-NULL
+2
select max(b) from t1 where a = 2;
max(b)
1
diff --git a/mysql-test/r/null.result b/mysql-test/r/null.result
index 91af34b6681..08612fa191f 100644
--- a/mysql-test/r/null.result
+++ b/mysql-test/r/null.result
@@ -73,3 +73,39 @@ b ifnull(t2.b,"this is null")
NULL this is null
NULL this is null
drop table t1;
+CREATE TABLE t1 (a varchar(16) NOT NULL, b smallint(6) NOT NULL, c datetime NOT NULL, d smallint(6) NOT NULL);
+INSERT INTO t1 SET a = "", d= "2003-01-14 03:54:55";
+UPDATE t1 SET d=1/NULL;
+UPDATE t1 SET d=NULL;
+INSERT INTO t1 (a) values (null);
+Column 'a' cannot be null
+INSERT INTO t1 (a) values (1/null);
+Column 'a' cannot be null
+INSERT INTO t1 (a) values (null),(null);
+INSERT INTO t1 (b) values (null);
+Column 'b' cannot be null
+INSERT INTO t1 (b) values (1/null);
+Column 'b' cannot be null
+INSERT INTO t1 (b) values (null),(null);
+INSERT INTO t1 (c) values (null);
+Column 'c' cannot be null
+INSERT INTO t1 (c) values (1/null);
+Column 'c' cannot be null
+INSERT INTO t1 (c) values (null),(null);
+INSERT INTO t1 (d) values (null);
+Column 'd' cannot be null
+INSERT INTO t1 (d) values (1/null);
+Column 'd' cannot be null
+INSERT INTO t1 (d) values (null),(null);
+select * from t1;
+a b c d
+ 0 0000-00-00 00:00:00 0
+ 0 0000-00-00 00:00:00 0
+ 0 0000-00-00 00:00:00 0
+ 0 0000-00-00 00:00:00 0
+ 0 0000-00-00 00:00:00 0
+ 0 0000-00-00 00:00:00 0
+ 0 0000-00-00 00:00:00 0
+ 0 0000-00-00 00:00:00 0
+ 0 0000-00-00 00:00:00 0
+drop table t1;
diff --git a/mysql-test/r/rpl_loaddata.result b/mysql-test/r/rpl_loaddata.result
new file mode 100644
index 00000000000..27f3d185f63
--- /dev/null
+++ b/mysql-test/r/rpl_loaddata.result
@@ -0,0 +1,13 @@
+slave stop;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+slave start;
+create table t1(a int not null auto_increment, b int, primary key(a) );
+load data infile '../../std_data/rpl_loaddata.dat' into table t1;
+select * from t1;
+a b
+1 10
+2 15
+drop table t1;
diff --git a/mysql-test/std_data/rpl_loaddata.dat b/mysql-test/std_data/rpl_loaddata.dat
new file mode 100644
index 00000000000..a70a059c2ab
--- /dev/null
+++ b/mysql-test/std_data/rpl_loaddata.dat
@@ -0,0 +1,2 @@
+\N 10
+\N 15
diff --git a/mysql-test/t/group_by.test b/mysql-test/t/group_by.test
index a34c3a12363..bca86f1ef37 100644
--- a/mysql-test/t/group_by.test
+++ b/mysql-test/t/group_by.test
@@ -363,3 +363,14 @@ m.c1id = c1.id AND c1.active = 'Yes' LEFT JOIN t3 AS c2 ON m.c2id =
c2.id AND c2.active = 'Yes' WHERE m.pid=1 AND (c1.id IS NOT NULL OR c2.id IS
NOT NULL);
drop table t1,t2,t3;
+
+#
+# Test bug in GROUP BY on BLOB that is NULL or empty
+#
+
+create table t1 (a blob null);
+insert into t1 values (NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(""),(""),(""),("b");
+select a,count(*) from t1 group by a;
+set option sql_big_tables=1;
+select a,count(*) from t1 group by a;
+drop table t1;
diff --git a/mysql-test/t/merge.test b/mysql-test/t/merge.test
index f84e10b0e3c..7a7678afca1 100644
--- a/mysql-test/t/merge.test
+++ b/mysql-test/t/merge.test
@@ -109,7 +109,7 @@ drop table t3,t2,t1;
#
# Test table without unions
#
-create table t1 (a int not null) type=merge;
+create table t1 (a int not null, key(a)) type=merge;
select * from t1;
drop table t1;
diff --git a/mysql-test/t/null.test b/mysql-test/t/null.test
index 087ef81e13e..fa36249dce0 100644
--- a/mysql-test/t/null.test
+++ b/mysql-test/t/null.test
@@ -52,3 +52,34 @@ insert into t1 values(10,null);
select t2.b, ifnull(t2.b,"this is null") from t1 as t2 left join t1 as t3 on
t2.b=t3.a order by 1;
drop table t1;
+
+#
+# Test inserting and updating with NULL
+#
+CREATE TABLE t1 (a varchar(16) NOT NULL, b smallint(6) NOT NULL, c datetime NOT NULL, d smallint(6) NOT NULL);
+INSERT INTO t1 SET a = "", d= "2003-01-14 03:54:55";
+UPDATE t1 SET d=1/NULL;
+UPDATE t1 SET d=NULL;
+--error 1048
+INSERT INTO t1 (a) values (null);
+--error 1048
+INSERT INTO t1 (a) values (1/null);
+INSERT INTO t1 (a) values (null),(null);
+--error 1048
+INSERT INTO t1 (b) values (null);
+--error 1048
+INSERT INTO t1 (b) values (1/null);
+INSERT INTO t1 (b) values (null),(null);
+--error 1048
+INSERT INTO t1 (c) values (null);
+--error 1048
+INSERT INTO t1 (c) values (1/null);
+INSERT INTO t1 (c) values (null),(null);
+--error 1048
+INSERT INTO t1 (d) values (null);
+--error 1048
+INSERT INTO t1 (d) values (1/null);
+INSERT INTO t1 (d) values (null),(null);
+select * from t1;
+drop table t1;
+
diff --git a/mysql-test/t/rpl_loaddata.test b/mysql-test/t/rpl_loaddata.test
new file mode 100644
index 00000000000..d7fc2a10ca4
--- /dev/null
+++ b/mysql-test/t/rpl_loaddata.test
@@ -0,0 +1,16 @@
+# See if replication of a "LOAD DATA in an autoincrement column"
+# Honours autoincrement values
+# i.e. if the master and slave have the same sequence
+source include/master-slave.inc;
+
+create table t1(a int not null auto_increment, b int, primary key(a) );
+load data infile '../../std_data/rpl_loaddata.dat' into table t1;
+save_master_pos;
+connection slave;
+sync_with_master;
+select * from t1;
+connection master;
+drop table t1;
+save_master_pos;
+connection slave;
+sync_with_master;
diff --git a/mysql-test/t/rpl_log-master.opt b/mysql-test/t/rpl_log-master.opt
new file mode 100644
index 00000000000..e0d075c3fbd
--- /dev/null
+++ b/mysql-test/t/rpl_log-master.opt
@@ -0,0 +1 @@
+--skip-external-locking