Merge mysql.com:/home/ram/work/mysql-5.0-maint

into  mysql.com:/home/ram/work/b26851/b26851.5.0
parents df75e6e5 bc180589
...@@ -1391,4 +1391,10 @@ create table t1 (f1 set('a','a')); ...@@ -1391,4 +1391,10 @@ create table t1 (f1 set('a','a'));
ERROR HY000: Column 'f1' has duplicated value 'a' in SET ERROR HY000: Column 'f1' has duplicated value 'a' in SET
create table t1 (f1 enum('a','a')); create table t1 (f1 enum('a','a'));
ERROR HY000: Column 'f1' has duplicated value 'a' in ENUM 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 End of 5.0 tests
...@@ -1258,4 +1258,12 @@ create table t1 (f1 set('a','a')); ...@@ -1258,4 +1258,12 @@ create table t1 (f1 set('a','a'));
--error 1291 --error 1291
create table t1 (f1 enum('a','a')); 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 --echo End of 5.0 tests
...@@ -316,7 +316,8 @@ static bool convert_constant_item(THD *thd, Field *field, Item **item) ...@@ -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 */ /* For comparison purposes allow invalid dates like 2000-01-32 */
ulong orig_sql_mode= thd->variables.sql_mode; 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)) if (!(*item)->save_in_field(field, 1) && !((*item)->null_value))
{ {
Item *tmp=new Item_int_with_ref(field->val_int(), *item, Item *tmp=new Item_int_with_ref(field->val_int(), *item,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment