summaryrefslogtreecommitdiff
path: root/mysql-test
diff options
context:
space:
mode:
authorunknown <monty@mashka.mysql.fi>2003-01-14 11:27:26 +0200
committerunknown <monty@mashka.mysql.fi>2003-01-14 11:27:26 +0200
commitef6c36c0c262ada284647cdf91d4cc2c599b7fdf (patch)
treed53ba7e1a43cc73daf4f75fa37f9467d8792fd64 /mysql-test
parentda1ff072c28eb58197892ba28c281e6ad0487c17 (diff)
downloadmariadb-git-ef6c36c0c262ada284647cdf91d4cc2c599b7fdf.tar.gz
Guard against compiling without -fno-exceptions
Allocate bigger default thread stack because of problems with glibc Fixed bug in UPDATE ... not_null_field=expression_that_returns_null Fixed bug in replication when using auto_increment and LOAD DATA INFILE include/my_global.h: Guard against compiling without -fno-exceptions include/my_pthread.h: Allocate bigger default thread stack because of problems with glibc mysql-test/r/null.result: Updated result mysql-test/t/null.test: Test of using UPDATE/INSERT with NULL on not null fields. sql/field_conv.cc: Fixed bug in UPDATE ... not_null_field=expression_that_returns_null sql/sql_load.cc: Fixed bug in replication when using auto_increment and LOAD DATA INFILE
Diffstat (limited to 'mysql-test')
-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/null.test31
-rw-r--r--mysql-test/t/rpl_loaddata.test16
-rw-r--r--mysql-test/t/rpl_log-master.opt1
6 files changed, 99 insertions, 0 deletions
diff --git a/mysql-test/r/null.result b/mysql-test/r/null.result
index cdea66cbf58..ba2161d3147 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/null.test b/mysql-test/t/null.test
index ad32e0be6ff..6fea7f0d10d 100644
--- a/mysql-test/t/null.test
+++ b/mysql-test/t/null.test
@@ -48,3 +48,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