Below is the list of changes that have just been committed into a local
5.1 repository of uchum. When uchum does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html
ChangeSet@stripped, 2008-01-11 05:06:08+04:00, gshchepa@stripped +18 -0
Bug#33699: The UPDATE statement allows NULL as new value on a NOT NULL
columns (default datatype value is assigned).
The mysql_update function has been modified to generate
an error when trying to set a NOT NULL field to NULL rather than a warning
in the set_field_to_null_with_conversions function.
mysql-test/extra/rpl_tests/rpl_extraMaster_Col.test@stripped, 2008-01-11 05:04:09+04:00,
gshchepa@stripped +1 -1
Updated test case (for bug#33699).
mysql-test/include/ps_modify.inc@stripped, 2008-01-11 05:04:16+04:00, gshchepa@stripped +1 -0
Updated test case (for bug#33699).
mysql-test/r/auto_increment.result@stripped, 2008-01-11 05:04:18+04:00, gshchepa@stripped +6
-6
Updated test case (for bug#33699).
mysql-test/r/null.result@stripped, 2008-01-11 05:04:19+04:00, gshchepa@stripped +3 -5
Updated test case (for bug#33699).
mysql-test/r/ps_2myisam.result@stripped, 2008-01-11 05:04:19+04:00, gshchepa@stripped +2 -3
Updated test case (for bug#33699).
mysql-test/r/ps_3innodb.result@stripped, 2008-01-11 05:04:20+04:00, gshchepa@stripped +2 -3
Updated test case (for bug#33699).
mysql-test/r/ps_4heap.result@stripped, 2008-01-11 05:04:21+04:00, gshchepa@stripped +2 -3
Updated test case (for bug#33699).
mysql-test/r/ps_5merge.result@stripped, 2008-01-11 05:04:21+04:00, gshchepa@stripped +4 -6
Updated test case (for bug#33699).
mysql-test/r/warnings.result@stripped, 2008-01-11 05:04:22+04:00, gshchepa@stripped +1 -2
Updated test case (for bug#33699).
mysql-test/suite/ndb/r/ps_7ndb.result@stripped, 2008-01-11 05:04:23+04:00, gshchepa@stripped
+2 -3
Updated test case (for bug#33699).
mysql-test/suite/rpl/r/rpl_extraColmaster_innodb.result@stripped, 2008-01-11 05:04:23+04:00,
gshchepa@stripped +1770 -1774
Updated test case (for bug#33699).
mysql-test/suite/rpl/r/rpl_extraColmaster_myisam.result@stripped, 2008-01-11 05:04:24+04:00,
gshchepa@stripped +1770 -1774
Updated test case (for bug#33699).
mysql-test/suite/rpl/t/rpl_err_ignoredtable.test@stripped, 2008-01-11 05:04:25+04:00,
gshchepa@stripped +1 -1
Updated test case (for bug#33699).
mysql-test/t/auto_increment.test@stripped, 2008-01-11 05:04:26+04:00, gshchepa@stripped +2
-0
Updated test case (for bug#33699).
mysql-test/t/null.test@stripped, 2008-01-11 05:04:27+04:00, gshchepa@stripped +2 -0
Updated test case (for bug#33699).
mysql-test/t/warnings.test@stripped, 2008-01-11 05:04:28+04:00, gshchepa@stripped +1 -0
Updated test case (for bug#33699).
sql/sql_update.cc@stripped, 2008-01-11 05:04:28+04:00, gshchepa@stripped +3 -1
Bug#33699: The mysql_update function has been modified to generate
an error when trying to set a NOT NULL field to NULL rather than
a warning in the set_field_to_null_with_conversions function.
tests/mysql_client_test.c@stripped, 2008-01-11 05:04:30+04:00, gshchepa@stripped +1 -1
Updated test case (for bug#33699).
diff -Nrup a/mysql-test/extra/rpl_tests/rpl_extraMaster_Col.test
b/mysql-test/extra/rpl_tests/rpl_extraMaster_Col.test
--- a/mysql-test/extra/rpl_tests/rpl_extraMaster_Col.test 2007-11-14 14:01:39 +04:00
+++ b/mysql-test/extra/rpl_tests/rpl_extraMaster_Col.test 2008-01-11 05:04:09 +04:00
@@ -419,7 +419,7 @@ connection master;
update t31 set f5=555555555555555 where f3=6;
update t31 set f2=2 where f3=2;
update t31 set f1=NULL where f3=1;
- update t31 set f3=NULL, f27=NULL, f35='f35 new value' where f3=3;
+ update t31 set f3=0, f27=NULL, f35='f35 new value' where f3=3;
--echo
--echo ** Delete from Master **
diff -Nrup a/mysql-test/include/ps_modify.inc b/mysql-test/include/ps_modify.inc
--- a/mysql-test/include/ps_modify.inc 2007-06-06 22:48:33 +05:00
+++ b/mysql-test/include/ps_modify.inc 2008-01-11 05:04:16 +04:00
@@ -108,6 +108,7 @@ execute stmt1 using @arg00, @arg01;
select a,b from t1 where a=@arg00;
set @arg00=NULL;
set @arg01=2;
+--error 1048
execute stmt1 using @arg00, @arg01;
select a,b from t1 order by a;
set @arg00=0;
diff -Nrup a/mysql-test/r/auto_increment.result b/mysql-test/r/auto_increment.result
--- a/mysql-test/r/auto_increment.result 2007-05-31 14:19:10 +05:00
+++ b/mysql-test/r/auto_increment.result 2008-01-11 05:04:18 +04:00
@@ -231,8 +231,7 @@ a b
204 7
delete from t1 where a=0;
update t1 set a=NULL where b=6;
-Warnings:
-Warning 1048 Column 'a' cannot be null
+ERROR 23000: Column 'a' cannot be null
update t1 set a=300 where b=7;
SET SQL_MODE='';
insert into t1(a,b)values(NULL,8);
@@ -247,7 +246,7 @@ a b
1 1
200 2
201 4
-0 6
+203 6
300 7
301 8
400 9
@@ -263,6 +262,7 @@ a b
1 1
200 2
201 4
+203 6
300 7
301 8
400 9
@@ -273,20 +273,20 @@ a b
405 14
delete from t1 where a=0;
update t1 set a=NULL where b=13;
-Warnings:
-Warning 1048 Column 'a' cannot be null
+ERROR 23000: Column 'a' cannot be null
update t1 set a=500 where b=14;
select * from t1 order by b;
a b
1 1
200 2
201 4
+203 6
300 7
301 8
400 9
401 10
402 11
-0 13
+404 13
500 14
drop table t1;
create table t1 (a bigint);
diff -Nrup a/mysql-test/r/null.result b/mysql-test/r/null.result
--- a/mysql-test/r/null.result 2007-10-11 23:09:03 +05:00
+++ b/mysql-test/r/null.result 2008-01-11 05:04:19 +04:00
@@ -93,11 +93,9 @@ INSERT INTO t1 SET a = "", d= "2003-01-1
Warnings:
Warning 1265 Data truncated for column 'd' at row 1
UPDATE t1 SET d=1/NULL;
-Warnings:
-Warning 1265 Data truncated for column 'd' at row 1
+ERROR 23000: Column 'd' cannot be null
UPDATE t1 SET d=NULL;
-Warnings:
-Warning 1048 Column 'd' cannot be null
+ERROR 23000: Column 'd' cannot be null
INSERT INTO t1 (a) values (null);
ERROR 23000: Column 'a' cannot be null
INSERT INTO t1 (a) values (1/null);
@@ -132,7 +130,7 @@ Warning 1048 Column 'd' cannot be null
Warning 1048 Column 'd' cannot be null
select * from t1;
a b c d
- 0 0000-00-00 00:00:00 0
+ 0 0000-00-00 00:00:00 2003
0 0000-00-00 00:00:00 0
0 0000-00-00 00:00:00 0
0 0000-00-00 00:00:00 0
diff -Nrup a/mysql-test/r/ps_2myisam.result b/mysql-test/r/ps_2myisam.result
--- a/mysql-test/r/ps_2myisam.result 2007-12-07 17:50:55 +04:00
+++ b/mysql-test/r/ps_2myisam.result 2008-01-11 05:04:19 +04:00
@@ -1303,12 +1303,11 @@ a b
set @arg00=NULL;
set @arg01=2;
execute stmt1 using @arg00, @arg01;
-Warnings:
-Warning 1048 Column 'a' cannot be null
+ERROR 23000: Column 'a' cannot be null
select a,b from t1 order by a;
a b
-0 two
1 one
+2 two
3 three
4 four
set @arg00=0;
diff -Nrup a/mysql-test/r/ps_3innodb.result b/mysql-test/r/ps_3innodb.result
--- a/mysql-test/r/ps_3innodb.result 2007-12-07 17:50:55 +04:00
+++ b/mysql-test/r/ps_3innodb.result 2008-01-11 05:04:20 +04:00
@@ -1286,12 +1286,11 @@ a b
set @arg00=NULL;
set @arg01=2;
execute stmt1 using @arg00, @arg01;
-Warnings:
-Warning 1048 Column 'a' cannot be null
+ERROR 23000: Column 'a' cannot be null
select a,b from t1 order by a;
a b
-0 two
1 one
+2 two
3 three
4 four
set @arg00=0;
diff -Nrup a/mysql-test/r/ps_4heap.result b/mysql-test/r/ps_4heap.result
--- a/mysql-test/r/ps_4heap.result 2007-12-07 17:50:55 +04:00
+++ b/mysql-test/r/ps_4heap.result 2008-01-11 05:04:21 +04:00
@@ -1287,12 +1287,11 @@ a b
set @arg00=NULL;
set @arg01=2;
execute stmt1 using @arg00, @arg01;
-Warnings:
-Warning 1048 Column 'a' cannot be null
+ERROR 23000: Column 'a' cannot be null
select a,b from t1 order by a;
a b
-0 two
1 one
+2 two
3 three
4 four
set @arg00=0;
diff -Nrup a/mysql-test/r/ps_5merge.result b/mysql-test/r/ps_5merge.result
--- a/mysql-test/r/ps_5merge.result 2007-12-07 17:50:55 +04:00
+++ b/mysql-test/r/ps_5merge.result 2008-01-11 05:04:21 +04:00
@@ -1329,12 +1329,11 @@ a b
set @arg00=NULL;
set @arg01=2;
execute stmt1 using @arg00, @arg01;
-Warnings:
-Warning 1048 Column 'a' cannot be null
+ERROR 23000: Column 'a' cannot be null
select a,b from t1 order by a;
a b
-0 two
1 one
+2 two
3 three
4 four
set @arg00=0;
@@ -4351,12 +4350,11 @@ a b
set @arg00=NULL;
set @arg01=2;
execute stmt1 using @arg00, @arg01;
-Warnings:
-Warning 1048 Column 'a' cannot be null
+ERROR 23000: Column 'a' cannot be null
select a,b from t1 order by a;
a b
-0 two
1 one
+2 two
3 three
4 four
set @arg00=0;
diff -Nrup a/mysql-test/r/warnings.result b/mysql-test/r/warnings.result
--- a/mysql-test/r/warnings.result 2007-06-26 16:15:02 +05:00
+++ b/mysql-test/r/warnings.result 2008-01-11 05:04:22 +04:00
@@ -98,8 +98,7 @@ Warning 1265 Data truncated for column '
Warning 1265 Data truncated for column 'c' at row 2
alter table t1 add d char(2);
update t1 set a=NULL where a=10;
-Warnings:
-Warning 1048 Column 'a' cannot be null
+ERROR 23000: Column 'a' cannot be null
update t1 set c='mysql ab' where c='test';
Warnings:
Warning 1265 Data truncated for column 'c' at row 4
diff -Nrup a/mysql-test/suite/ndb/r/ps_7ndb.result b/mysql-test/suite/ndb/r/ps_7ndb.result
--- a/mysql-test/suite/ndb/r/ps_7ndb.result 2007-12-07 17:50:55 +04:00
+++ b/mysql-test/suite/ndb/r/ps_7ndb.result 2008-01-11 05:04:23 +04:00
@@ -1286,12 +1286,11 @@ a b
set @arg00=NULL;
set @arg01=2;
execute stmt1 using @arg00, @arg01;
-Warnings:
-Warning 1048 Column 'a' cannot be null
+ERROR 23000: Column 'a' cannot be null
select a,b from t1 order by a;
a b
-0 two
1 one
+2 two
3 three
4 four
set @arg00=0;
diff -Nrup a/mysql-test/suite/rpl/r/rpl_extraColmaster_innodb.result
b/mysql-test/suite/rpl/r/rpl_extraColmaster_innodb.result
--- a/mysql-test/suite/rpl/r/rpl_extraColmaster_innodb.result 2007-11-23 15:51:10 +04:00
+++ b/mysql-test/suite/rpl/r/rpl_extraColmaster_innodb.result 2008-01-11 05:04:23 +04:00
@@ -454,9 +454,7 @@ f1 f2 f3 f4
update t31 set f5=555555555555555 where f3=6;
update t31 set f2=2 where f3=2;
update t31 set f1=NULL where f3=1;
-update t31 set f3=NULL, f27=NULL, f35='f35 new value' where f3=3;
-Warnings:
-Warning 1048 Column 'f3' cannot be null
+update t31 set f3=0, f27=NULL, f35='f35 new value' where f3=3;
** Delete from Master **
@@ -1594,9 +1592,7 @@ f1 f2 f3 f4
update t31 set f5=555555555555555 where f3=6;
update t31 set f2=2 where f3=2;
update t31 set f1=NULL where f3=1;
-update t31 set f3=NULL, f27=NULL, f35='f35 new value' where f3=3;
-Warnings:
-Warning 1048 Column 'f3' cannot be null
+update t31 set f3=0, f27=NULL, f35='f35 new value' where f3=3;
** Delete from Master **
@@ -2734,9 +2730,7 @@ f1 f2 f3 f4
update t31 set f5=555555555555555 where f3=6;
update t31 set f2=2 where f3=2;
update t31 set f1=NULL where f3=1;
-update t31 set f3=NULL, f27=NULL, f35='f35 new value' where f3=3;
-Warnings:
-Warning 1048 Column 'f3' cannot be null
+update t31 set f3=0, f27=NULL, f35='f35 new value' where f3=3;
** Delete from Master **
diff -Nrup a/mysql-test/suite/rpl/r/rpl_extraColmaster_myisam.result
b/mysql-test/suite/rpl/r/rpl_extraColmaster_myisam.result
--- a/mysql-test/suite/rpl/r/rpl_extraColmaster_myisam.result 2007-11-23 15:51:10 +04:00
+++ b/mysql-test/suite/rpl/r/rpl_extraColmaster_myisam.result 2008-01-11 05:04:24 +04:00
@@ -454,9 +454,7 @@ f1 f2 f3 f4
update t31 set f5=555555555555555 where f3=6;
update t31 set f2=2 where f3=2;
update t31 set f1=NULL where f3=1;
-update t31 set f3=NULL, f27=NULL, f35='f35 new value' where f3=3;
-Warnings:
-Warning 1048 Column 'f3' cannot be null
+update t31 set f3=0, f27=NULL, f35='f35 new value' where f3=3;
** Delete from Master **
@@ -1594,9 +1592,7 @@ f1 f2 f3 f4
update t31 set f5=555555555555555 where f3=6;
update t31 set f2=2 where f3=2;
update t31 set f1=NULL where f3=1;
-update t31 set f3=NULL, f27=NULL, f35='f35 new value' where f3=3;
-Warnings:
-Warning 1048 Column 'f3' cannot be null
+update t31 set f3=0, f27=NULL, f35='f35 new value' where f3=3;
** Delete from Master **
@@ -2734,9 +2730,7 @@ f1 f2 f3 f4
update t31 set f5=555555555555555 where f3=6;
update t31 set f2=2 where f3=2;
update t31 set f1=NULL where f3=1;
-update t31 set f3=NULL, f27=NULL, f35='f35 new value' where f3=3;
-Warnings:
-Warning 1048 Column 'f3' cannot be null
+update t31 set f3=0, f27=NULL, f35='f35 new value' where f3=3;
** Delete from Master **
diff -Nrup a/mysql-test/suite/rpl/t/rpl_err_ignoredtable.test
b/mysql-test/suite/rpl/t/rpl_err_ignoredtable.test
--- a/mysql-test/suite/rpl/t/rpl_err_ignoredtable.test 2007-06-27 17:27:29 +05:00
+++ b/mysql-test/suite/rpl/t/rpl_err_ignoredtable.test 2008-01-11 05:04:25 +04:00
@@ -49,7 +49,7 @@ kill @id;
drop table t2,t3;
insert into t4 values (3),(4);
connection master;
---error 0,1053,2013
+--error 0,1053,2013,1048
reap;
connection master1;
save_master_pos;
diff -Nrup a/mysql-test/t/auto_increment.test b/mysql-test/t/auto_increment.test
--- a/mysql-test/t/auto_increment.test 2007-06-06 22:48:04 +05:00
+++ b/mysql-test/t/auto_increment.test 2008-01-11 05:04:26 +04:00
@@ -149,6 +149,7 @@ delete from t1 where a=0;
update t1 set a=0 where b=5;
select * from t1 order by b;
delete from t1 where a=0;
+--error 1048
update t1 set a=NULL where b=6;
update t1 set a=300 where b=7;
SET SQL_MODE='';
@@ -164,6 +165,7 @@ delete from t1 where a=0;
update t1 set a=0 where b=12;
select * from t1 order by b;
delete from t1 where a=0;
+--error 1048
update t1 set a=NULL where b=13;
update t1 set a=500 where b=14;
select * from t1 order by b;
diff -Nrup a/mysql-test/t/null.test b/mysql-test/t/null.test
--- a/mysql-test/t/null.test 2007-10-10 19:50:26 +05:00
+++ b/mysql-test/t/null.test 2008-01-11 05:04:27 +04:00
@@ -61,7 +61,9 @@ drop table t1;
#
CREATE TABLE t1 (a varchar(16) NOT NULL default '', b smallint(6) NOT NULL default 0, c
datetime NOT NULL default '0000-00-00 00:00:00', d smallint(6) NOT NULL default 0);
INSERT INTO t1 SET a = "", d= "2003-01-14 03:54:55";
+--error 1048
UPDATE t1 SET d=1/NULL;
+--error 1048
UPDATE t1 SET d=NULL;
--error 1048
INSERT INTO t1 (a) values (null);
diff -Nrup a/mysql-test/t/warnings.test b/mysql-test/t/warnings.test
--- a/mysql-test/t/warnings.test 2007-01-07 18:31:46 +04:00
+++ b/mysql-test/t/warnings.test 2008-01-11 05:04:28 +04:00
@@ -65,6 +65,7 @@ create table t1(a tinyint NOT NULL, b ti
insert into t1 values(NULL,100,'mysql'),(10,-1,'mysql ab'),(500,256,'open
source'),(20,NULL,'test');
alter table t1 modify c char(4);
alter table t1 add d char(2);
+--error 1048
update t1 set a=NULL where a=10;
update t1 set c='mysql ab' where c='test';
update t1 set d=c;
diff -Nrup a/sql/sql_update.cc b/sql/sql_update.cc
--- a/sql/sql_update.cc 2007-11-14 14:01:49 +04:00
+++ b/sql/sql_update.cc 2008-01-11 05:04:28 +04:00
@@ -526,7 +526,9 @@ int mysql_update(THD *thd,
init_read_record(&info,thd,table,select,0,1);
updated= found= 0;
- thd->count_cuted_fields= CHECK_FIELD_WARN; /* calc cuted fields */
+ /* Generate an error when trying to set a NOT NULL field to NULL. */
+ thd->count_cuted_fields= ignore ? CHECK_FIELD_WARN
+ : CHECK_FIELD_ERROR_FOR_NULL;
thd->cuted_fields=0L;
thd->proc_info="Updating";
diff -Nrup a/tests/mysql_client_test.c b/tests/mysql_client_test.c
--- a/tests/mysql_client_test.c 2007-12-13 16:43:36 +04:00
+++ b/tests/mysql_client_test.c 2008-01-11 05:04:30 +04:00
@@ -15674,7 +15674,7 @@ static void test_mysql_insert_id()
myquery(rc);
res= mysql_insert_id(mysql);
DIE_UNLESS(res == 0);
- rc= mysql_query(mysql, "update t2 set f1=NULL where f1=14");
+ rc= mysql_query(mysql, "update t2 set f1=0 where f1=14");
myquery(rc);
res= mysql_insert_id(mysql);
DIE_UNLESS(res == 0);
| Thread |
|---|
| • bk commit into 5.1 tree (gshchepa:1.2656) BUG#33699 | gshchepa | 11 Jan |