Commit 6db5e7f4 authored by serg@serg.mylan's avatar serg@serg.mylan

"delete from table where const" bug fixed

parent 1a8b0b38
...@@ -53,5 +53,11 @@ select * from t1 where misc > 5 and bool is null; ...@@ -53,5 +53,11 @@ select * from t1 where misc > 5 and bool is null;
delete from t1 where misc > 5 and bool is null; delete from t1 where misc > 5 and bool is null;
select * from t1 where misc > 5 and bool is null; select * from t1 where misc > 5 and bool is null;
select count(*) from t1;
delete from t1 where 1 > 2;
select count(*) from t1;
delete from t1 where 3 > 2;
select count(*) from t1;
drop table t1; drop table t1;
...@@ -54,7 +54,7 @@ int mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds, ORDER *order, ...@@ -54,7 +54,7 @@ int mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds, ORDER *order,
DBUG_RETURN(-1); DBUG_RETURN(-1);
/* Test if the user wants to delete all rows */ /* Test if the user wants to delete all rows */
if (!using_limit && (!conds || conds->const_item()) && if (!using_limit && (!conds || (conds->const_item() && conds->val_int())) &&
!(specialflag & (SPECIAL_NO_NEW_FUNC | SPECIAL_SAFE_MODE)) && !safe_update) !(specialflag & (SPECIAL_NO_NEW_FUNC | SPECIAL_SAFE_MODE)) && !safe_update)
{ {
deleted= table->file->records; deleted= table->file->records;
......
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