diff options
author | unknown <ramil/ram@mysql.com/ramil.myoffice.izhnet.ru> | 2007-04-19 15:02:36 +0500 |
---|---|---|
committer | unknown <ramil/ram@mysql.com/ramil.myoffice.izhnet.ru> | 2007-04-19 15:02:36 +0500 |
commit | 0a3533ff5740d71f70472844570b46b0410ef93c (patch) | |
tree | 1d78e000b54d1c7e01ef3b49ee43996e75b8f557 | |
parent | 30f3f3a037beb745f367db7c1695122cbb4c1517 (diff) | |
parent | 5198d0b4a8aabb57a5b1245464d238a17f033f94 (diff) | |
download | mariadb-git-0a3533ff5740d71f70472844570b46b0410ef93c.tar.gz |
Merge mysql.com:/home/ram/work/mysql-5.0-maint
into mysql.com:/home/ram/work/b26851/b26851.5.0
-rw-r--r-- | mysql-test/r/strict.result | 6 | ||||
-rw-r--r-- | mysql-test/t/strict.test | 8 | ||||
-rw-r--r-- | sql/item_cmpfunc.cc | 3 |
3 files changed, 16 insertions, 1 deletions
diff --git a/mysql-test/r/strict.result b/mysql-test/r/strict.result index f9d84df5d9f..eecdc545be7 100644 --- a/mysql-test/r/strict.result +++ b/mysql-test/r/strict.result @@ -1391,4 +1391,10 @@ create table t1 (f1 set('a','a')); ERROR HY000: Column 'f1' has duplicated value 'a' in SET create table t1 (f1 enum('a','a')); ERROR HY000: Column 'f1' has duplicated value 'a' in ENUM +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 diff --git a/mysql-test/t/strict.test b/mysql-test/t/strict.test index 1792c0fccbc..faca9e7b080 100644 --- a/mysql-test/t/strict.test +++ b/mysql-test/t/strict.test @@ -1258,4 +1258,12 @@ create table t1 (f1 set('a','a')); --error 1291 create table t1 (f1 enum('a','a')); +# +# 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 diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc index 1c0ece8877b..6f207e920d0 100644 --- a/sql/item_cmpfunc.cc +++ b/sql/item_cmpfunc.cc @@ -316,7 +316,8 @@ static bool convert_constant_item(THD *thd, Field *field, Item **item) { /* 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, |