mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
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.
This commit is contained in:
@ -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);
|
||||
|
Reference in New Issue
Block a user