From d2c90fcb8ecee24d68df83c83a70c0a8b8ab77c8 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 27 Oct 2006 18:08:50 +0500 Subject: Fix for bug #23412: delete rows with null date field Backport of the fix for bug #8143: A date with value 0 is treated as a NULL value mysql-test/r/delete.result: Fix for bug #23412: delete rows with null date field - test result mysql-test/t/delete.test: Fix for bug #23412: delete rows with null date field - test case sql/sql_delete.cc: Fix for bug #23412: delete rows with null date field - during SELECT queries processing we convert 'date[time]_field is null' conditions into 'date[time]_field = 0000-00-00[ 00:00:00]' for not null DATE and DATETIME fields. To be consistent, we have to do the same for DELETE queries. So we should call remove_eq_conds() in the mysql_delete() as well. Also it may simplify and speed up DELETE queries execution. --- mysql-test/t/delete.test | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'mysql-test/t/delete.test') diff --git a/mysql-test/t/delete.test b/mysql-test/t/delete.test index d4eb01cab23..2036b59d810 100644 --- a/mysql-test/t/delete.test +++ b/mysql-test/t/delete.test @@ -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 -- cgit v1.2.1