Below is the list of changes that have just been committed into a local
5.0 repository of evgen. When evgen does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html
ChangeSet
1.2160 06/05/30 19:16:30 evgen@stripped +3 -0
Manually merged
sql/item_cmpfunc.cc
1.203 06/05/30 19:16:28 evgen@stripped +0 -24
Manually merged
mysql-test/r/func_in.result
1.26 06/05/30 19:16:28 evgen@stripped +0 -0
Manually merged
mysql-test/t/func_in.test
1.21 06/05/30 19:13:19 evgen@stripped +0 -0
Auto merged
# This is a BitKeeper patch. What follows are the unified diffs for the
# set of deltas contained in the patch. The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User: evgen
# Host: moonbone.local
# Root: /work/18360-bug-5.0-mysql-opt/RESYNC
--- 1.202/sql/item_cmpfunc.cc 2006-05-18 22:25:38 +04:00
+++ 1.203/sql/item_cmpfunc.cc 2006-05-30 19:16:28 +04:00
@@ -76,11 +76,19 @@
field= NULL;
type[0]= items[0]->result_type();
- for (i= 1; i < nitems; i++)
+ /* Reset to 0 on first occurence of non-const item. 1 otherwise */
+ bool is_const= items[0]->const_item();
+
+ for (i= 1 ; i < nitems ; i++)
{
- type[0]= item_cmp_type(type[0], items[i]->result_type());
- if (field && convert_constant_item(thd, field, &items[i]))
- type[0]= INT_RESULT;
+ if (!items[i]->const_item())
+ {
+ type[0]= is_const ? items[i]->result_type() :
+ item_cmp_type(type[0], items[i]->result_type());
+ is_const= 0;
+ }
+ else if (is_const)
+ type[0]= item_cmp_type(type[0], items[i]->result_type());
}
}
--- 1.25/mysql-test/r/func_in.result 2006-05-15 14:18:17 +04:00
+++ 1.26/mysql-test/r/func_in.result 2006-05-30 19:16:28 +04:00
@@ -202,6 +202,27 @@
count(*)
1
drop table t1;
+create table t1 (f1 char(1), f2 int);
+insert into t1 values (1,0),('a',1),('z',2);
+select f1 from t1 where f1 in (1,'z');
+f1
+1
+z
+select f2 from t1 where f2 in (1,'z');
+f2
+0
+1
+select f1 from t1 where 'z' in (1,f1);
+f1
+z
+select * from t1 where 'z' in (f2,f1);
+f1 f2
+z 2
+select * from t1 where 1 in (f2,f1);
+f1 f2
+1 0
+a 1
+drop table t1;
CREATE TABLE t1 (a int PRIMARY KEY);
INSERT INTO t1 VALUES (44), (45), (46);
SELECT * FROM t1 WHERE a IN (45);
--- 1.20/mysql-test/t/func_in.test 2006-05-15 14:18:17 +04:00
+++ 1.21/mysql-test/t/func_in.test 2006-05-30 19:13:19 +04:00
@@ -109,6 +109,18 @@
select count(*) from t1 where id not in (1,2);
drop table t1;
+#
+# Bug#18360 Incorrect type coercion in IN() results in false comparison
+#
+create table t1 (f1 char(1), f2 int);
+insert into t1 values (1,0),('a',1),('z',2);
+select f1 from t1 where f1 in (1,'z');
+select f2 from t1 where f2 in (1,'z');
+select f1 from t1 where 'z' in (1,f1);
+select * from t1 where 'z' in (f2,f1);
+select * from t1 where 1 in (f2,f1);
+drop table t1;
+
# End of 4.1 tests
#
| Thread |
|---|
| • bk commit into 5.0 tree (evgen:1.2160) | eugene | 30 May |