From: Date: December 21 2006 10:53am Subject: bk commit into 5.0 tree (ramil:1.2336) BUG#22824 List-Archive: http://lists.mysql.com/commits/17256 X-Bug: 22824 Message-Id: <20061221095337.7F7EB3400075@ramil.myoffice.izhnet.ru> Below is the list of changes that have just been committed into a local 5.0 repository of ram. When ram 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, 2006-12-21 13:53:34+04:00, ramil@stripped +3 -0 Fix for bug #22824: strict, datetime, NULL, wrong warning During optimization we replace NULL with 0 for not null date{time} fields, so uset MODE_NO_ZERO_DATE flag for a while as we don't want to give extra warnings. mysql-test/r/strict.result@stripped, 2006-12-21 13:53:32+04:00, ramil@stripped +7 -0 Fix for bug #22824: strict, datetime, NULL, wrong warning - test result. mysql-test/t/strict.test@stripped, 2006-12-21 13:53:32+04:00, ramil@stripped +11 -0 Fix for bug #22824: strict, datetime, NULL, wrong warning - test case. sql/item_cmpfunc.cc@stripped, 2006-12-21 13:53:32+04:00, ramil@stripped +2 -1 Fix for bug #22824: strict, datetime, NULL, wrong warning - turn off MODE_NO_ZERO_DATE in order not to get extra warinings in the save_in_field(). # This is a BitKeeper patch. What follows are the unified diffs for the # set of deltas contained in the patch. The rest of the patch, the part # that BitKeeper cares about, is below these diffs. # User: ramil # Host: ramil.myoffice.izhnet.ru # Root: /home/ram/work/b22824/my50-b22824 --- 1.223/sql/item_cmpfunc.cc 2006-12-21 13:53:37 +04:00 +++ 1.224/sql/item_cmpfunc.cc 2006-12-21 13:53:37 +04:00 @@ -241,7 +241,8 @@ static bool convert_constant_item(THD *t { /* For comparison purposes allow invalid dates like 2000-01-32 */ ulong orig_sql_mode= thd->variables.sql_mode; - thd->variables.sql_mode|= MODE_INVALID_DATES; + thd->variables.sql_mode= (orig_sql_mode & ~MODE_NO_ZERO_DATE) | + MODE_INVALID_DATES; if (!(*item)->save_in_field(field, 1) && !((*item)->null_value)) { Item *tmp=new Item_int_with_ref(field->val_int(), *item, --- 1.31/mysql-test/r/strict.result 2006-12-21 13:53:37 +04:00 +++ 1.32/mysql-test/r/strict.result 2006-12-21 13:53:37 +04:00 @@ -1352,3 +1352,10 @@ t1 CREATE TABLE `t1` ( `i` int(11) default NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='123456789*123456789*123456789*123456789*123456789*123456789*' drop table t1; +set @@sql_mode='NO_ZERO_DATE'; +create table t1(a datetime not null); +select count(*) from t1 where a is null; +count(*) +0 +drop table t1; +End of 5.0 tests --- 1.23/mysql-test/t/strict.test 2006-12-21 13:53:37 +04:00 +++ 1.24/mysql-test/t/strict.test 2006-12-21 13:53:37 +04:00 @@ -1208,3 +1208,14 @@ create table t1 (i int) comment '123456789*123456789*123456789*123456789*123456789*123456789*'; show create table t1; drop table t1; + +# +# Bug #22824: strict, datetime, NULL, wrong warning +# + +set @@sql_mode='NO_ZERO_DATE'; +create table t1(a datetime not null); +select count(*) from t1 where a is null; +drop table t1; + +--echo End of 5.0 tests