Loading mysql-test/r/delete.result +11 −0 Original line number Diff line number Diff line Loading @@ -176,3 +176,14 @@ create table t1 (a int); delete `4.t1` from t1 as `4.t1` where `4.t1`.a = 5; delete FROM `4.t1` USING t1 as `4.t1` where `4.t1`.a = 5; drop table t1; create table t1(a date not null); insert into t1 values (0); select * from t1 where a is null; a 0000-00-00 delete from t1 where a is null; select count(*) from t1; count(*) 0 drop table t1; End of 4.1 tests mysql-test/t/delete.test +12 −1 Original line number Diff line number Diff line Loading @@ -163,4 +163,15 @@ delete `4.t1` from t1 as `4.t1` where `4.t1`.a = 5; delete FROM `4.t1` USING t1 as `4.t1` where `4.t1`.a = 5; drop table t1; # End of 4.1 tests # # Bug #8143: deleting '0000-00-00' values using IS NULL # create table t1(a date not null); insert into t1 values (0); select * from t1 where a is null; delete from t1 where a is null; select count(*) from t1; drop table t1; --echo End of 4.1 tests sql/sql_delete.cc +8 −0 Original line number Diff line number Diff line Loading @@ -79,6 +79,14 @@ int mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds, /* Handler didn't support fast delete; Delete rows one by one */ } if (conds) { Item::cond_result result; conds= remove_eq_conds(thd, conds, &result); if (result == Item::COND_FALSE) // Impossible where limit= 0; } table->used_keys.clear_all(); table->quick_keys.clear_all(); // Can't use 'only index' select=make_select(table,0,0,conds,&error); Loading Loading
mysql-test/r/delete.result +11 −0 Original line number Diff line number Diff line Loading @@ -176,3 +176,14 @@ create table t1 (a int); delete `4.t1` from t1 as `4.t1` where `4.t1`.a = 5; delete FROM `4.t1` USING t1 as `4.t1` where `4.t1`.a = 5; drop table t1; create table t1(a date not null); insert into t1 values (0); select * from t1 where a is null; a 0000-00-00 delete from t1 where a is null; select count(*) from t1; count(*) 0 drop table t1; End of 4.1 tests
mysql-test/t/delete.test +12 −1 Original line number Diff line number Diff line Loading @@ -163,4 +163,15 @@ delete `4.t1` from t1 as `4.t1` where `4.t1`.a = 5; delete FROM `4.t1` USING t1 as `4.t1` where `4.t1`.a = 5; drop table t1; # End of 4.1 tests # # Bug #8143: deleting '0000-00-00' values using IS NULL # create table t1(a date not null); insert into t1 values (0); select * from t1 where a is null; delete from t1 where a is null; select count(*) from t1; drop table t1; --echo End of 4.1 tests
sql/sql_delete.cc +8 −0 Original line number Diff line number Diff line Loading @@ -79,6 +79,14 @@ int mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds, /* Handler didn't support fast delete; Delete rows one by one */ } if (conds) { Item::cond_result result; conds= remove_eq_conds(thd, conds, &result); if (result == Item::COND_FALSE) // Impossible where limit= 0; } table->used_keys.clear_all(); table->quick_keys.clear_all(); // Can't use 'only index' select=make_select(table,0,0,conds,&error); Loading