2716 Gleb Shchepa 2008-07-14 [merge]
merge 5.1-bugteam --> 6.0-bugteam
modified:
mysql-test/r/func_in.result
mysql-test/t/func_in.test
sql/item_cmpfunc.cc
2715 Gleb Shchepa 2008-07-14 [merge]
empty merge 5.1-bugteam --> 6.0-bugteam
2714 Mats Kindahl 2008-07-13
Updating result files with mismatch caused by merge from 5.1.
modified:
mysql-test/suite/rpl/r/rpl_row_basic_2myisam.result
mysql-test/suite/rpl/r/rpl_row_basic_3innodb.result
=== modified file 'mysql-test/r/func_in.result'
--- a/mysql-test/r/func_in.result 2008-02-12 19:13:29 +0000
+++ b/mysql-test/r/func_in.result 2008-07-14 09:11:23 +0000
@@ -569,4 +569,10 @@ insert into t1 values (),(),(),(),(),(),
select a from t1 where a not in (a,a,a) group by a;
a
drop table t1;
+create table t1 (id int);
+select * from t1 where NOT id in (select null union all select 1);
+id
+select * from t1 where NOT id in (null, 1);
+id
+drop table t1;
End of 5.1 tests
=== modified file 'mysql-test/t/func_in.test'
--- a/mysql-test/t/func_in.test 2007-10-31 21:24:32 +0000
+++ b/mysql-test/t/func_in.test 2008-07-14 09:06:49 +0000
@@ -417,4 +417,13 @@ insert into t1 values (),(),(),(),(),(),
select a from t1 where a not in (a,a,a) group by a;
drop table t1;
+#
+# Bug #37761: IN handles NULL differently for table-subquery and value-list
+#
+
+create table t1 (id int);
+select * from t1 where NOT id in (select null union all select 1);
+select * from t1 where NOT id in (null, 1);
+drop table t1;
+
--echo End of 5.1 tests
=== modified file 'sql/item_cmpfunc.cc'
--- a/sql/item_cmpfunc.cc 2008-06-17 20:04:19 +0000
+++ b/sql/item_cmpfunc.cc 2008-07-14 09:11:23 +0000
@@ -3822,6 +3822,9 @@ longlong Item_func_in::val_int()
return (longlong) (!null_value && tmp != negated);
}
+ if ((null_value= args[0]->null_value))
+ return 0;
+ have_null= 0;
for (uint i= 1 ; i < arg_count ; i++)
{
Item_result cmp_type= item_cmp_type(left_result_type, args[i]->result_type());
@@ -3830,9 +3833,6 @@ longlong Item_func_in::val_int()
if (!(value_added_map & (1 << (uint)cmp_type)))
{
in_item->store_value(args[0]);
- if ((null_value=args[0]->null_value))
- return 0;
- have_null= 0;
value_added_map|= 1 << (uint)cmp_type;
}
if (!in_item->cmp(args[i]) && !args[i]->null_value)
| Thread |
|---|
| • bzr push into mysql-6.0 branch (gshchepa:2714 to 2716) | Gleb Shchepa | 14 Jul |