summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSinisa@sinisa.nasamreza.org <>2002-11-21 22:13:23 +0200
committerSinisa@sinisa.nasamreza.org <>2002-11-21 22:13:23 +0200
commit2e39c89b9db666c08b541828f0e0687521c4684d (patch)
treec876b68884e9fa608b69a540b4e4e77defc6f869
parentdd1b7e0c84a0f4b07dc8194d2c1721a6db01f297 (diff)
downloadmariadb-git-2e39c89b9db666c08b541828f0e0687521c4684d.tar.gz
A fix for the bug with:
delete from table where column<=>NULL on indexed columns
-rw-r--r--mysql-test/r/delete.result6
-rw-r--r--mysql-test/t/delete.test5
-rw-r--r--sql/opt_range.cc2
3 files changed, 12 insertions, 1 deletions
diff --git a/mysql-test/r/delete.result b/mysql-test/r/delete.result
index c2230722aa6..e3e95c79fb7 100644
--- a/mysql-test/r/delete.result
+++ b/mysql-test/r/delete.result
@@ -24,3 +24,9 @@ create table t1 (a bigint not null, primary key (a,a,a,a,a,a,a,a,a,a));
insert into t1 values (2),(4),(6),(8),(10),(12),(14),(16),(18),(20),(22),(24),(26),(23),(27);
delete from t1 where a=27;
drop table t1;
+create table t1 (id int, index(id));
+insert into t1 values(NULL);
+delete from t1 where id <=> NULL;
+select * from t1;
+id
+drop table if exists t1;
diff --git a/mysql-test/t/delete.test b/mysql-test/t/delete.test
index 953e22cdd55..fc57fdabcd5 100644
--- a/mysql-test/t/delete.test
+++ b/mysql-test/t/delete.test
@@ -35,3 +35,8 @@ create table t1 (a bigint not null, primary key (a,a,a,a,a,a,a,a,a,a));
insert into t1 values (2),(4),(6),(8),(10),(12),(14),(16),(18),(20),(22),(24),(26),(23),(27);
delete from t1 where a=27;
drop table t1;
+create table t1 (id int, index(id));
+insert into t1 values(NULL);
+delete from t1 where id <=> NULL;
+select * from t1;
+drop table if exists t1;
diff --git a/sql/opt_range.cc b/sql/opt_range.cc
index f33a2d312b4..14999097c62 100644
--- a/sql/opt_range.cc
+++ b/sql/opt_range.cc
@@ -1024,7 +1024,7 @@ get_mm_leaf(PARAM *param, Field *field, KEY_PART *key_part,
field->cmp_type() != value->result_type())
DBUG_RETURN(0);
- if (value->save_in_field(field))
+ if (value->save_in_field(field) || value->is_null())
{
// TODO; Check if we can we remove the following block.
if (type == Item_func::EQUAL_FUNC)