Below is the list of changes that have just been committed into a local
5.0 repository of kgeorge. When kgeorge 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.2167 06/06/14 15:57:23 gkodinov@stripped +3 -0
Bug #18895: BIT values cause joins to fail
The Field::eq() considered instances of Field_bit that differ only in
bit_ptr/bit_ofs equal. This caused equality conditions optimization
(build_equal_items_for_cond()) to make bad field substitutions that result
in wrong predicates.
Field_bit requires an overloaded eq() function that checks the bit_ptr/bit_ofs
in addition to Field::eq().
sql/field.h
1.181 06/06/14 15:57:17 gkodinov@stripped +8 -1
Bug #18895: BIT values cause joins to fail
- eq() method overloaded for Field_bit
mysql-test/t/select.test
1.104 06/06/14 15:57:17 gkodinov@stripped +26 -0
Bug #18895: BIT values cause joins to fail
- test case
mysql-test/r/select.result
1.127 06/06/14 15:57:17 gkodinov@stripped +20 -0
Bug #18895: BIT values cause joins to fail
- test case
# 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: gkodinov
# Host: rakia.(none)
# Root: /home/kgeorge/mysql/5.0/B18895
--- 1.180/sql/field.h 2006-05-24 11:56:55 +03:00
+++ 1.181/sql/field.h 2006-06-14 15:57:17 +03:00
@@ -124,7 +124,7 @@
static bool type_can_have_key_part(enum_field_types);
static enum_field_types field_type_merge(enum_field_types, enum_field_types);
static Item_result result_merge_type(enum_field_types);
- bool eq(Field *field)
+ virtual bool eq(Field *field)
{
return (ptr == field->ptr && null_ptr == field->null_ptr &&
null_bit == field->null_bit);
@@ -1357,6 +1357,13 @@
{
bit_ptr= bit_ptr_arg;
bit_ofs= bit_ofs_arg;
+ }
+ bool eq(Field *field)
+ {
+ return (Field::eq(field) &&
+ field->type() == type() &&
+ bit_ptr == ((Field_bit *)field)->bit_ptr &&
+ bit_ofs == ((Field_bit *)field)->bit_ofs);
}
};
--- 1.126/mysql-test/r/select.result 2006-06-02 18:02:17 +03:00
+++ 1.127/mysql-test/r/select.result 2006-06-14 15:57:17 +03:00
@@ -3359,3 +3359,23 @@
1 SIMPLE t1 range PRIMARY,b b 5 NULL 3 Using where
1 SIMPLE t2 ref c c 5 test.t1.a 2 Using where
DROP TABLE t1, t2;
+create table t1 (
+a int unsigned not null auto_increment primary key,
+b bit not null,
+c bit not null
+);
+create table t2 (
+a int unsigned not null auto_increment primary key,
+b bit not null,
+c int unsigned not null,
+d varchar(50)
+);
+insert into t1 (b,c) values (0,1), (0,1);
+insert into t2 (b,c) values (0,1);
+select t1.a, t1.b + 0, t1.c + 0, t2.a, t2.b + 0, t2.c, t2.d
+from t1 left outer join t2 on t1.a = t2.c and t2.b <> 1
+where t1.b <> 1 order by t1.a;
+a t1.b + 0 t1.c + 0 a t2.b + 0 c d
+1 0 1 1 0 1 NULL
+2 0 1 NULL NULL NULL NULL
+drop table t1,t2;
--- 1.103/mysql-test/t/select.test 2006-06-02 18:02:17 +03:00
+++ 1.104/mysql-test/t/select.test 2006-06-14 15:57:17 +03:00
@@ -2840,3 +2840,29 @@
SELECT a, c, d, f FROM t1,t2 WHERE a=c AND b BETWEEN 4 AND 6 AND a > 0;
DROP TABLE t1, t2;
+
+#
+# Bug #18895: BIT values cause joins to fail
+#
+create table t1 (
+ a int unsigned not null auto_increment primary key,
+ b bit not null,
+ c bit not null
+);
+
+create table t2 (
+ a int unsigned not null auto_increment primary key,
+ b bit not null,
+ c int unsigned not null,
+ d varchar(50)
+);
+
+insert into t1 (b,c) values (0,1), (0,1);
+insert into t2 (b,c) values (0,1);
+
+-- Row 1 should succeed. Row 2 should fail. Both fail.
+select t1.a, t1.b + 0, t1.c + 0, t2.a, t2.b + 0, t2.c, t2.d
+from t1 left outer join t2 on t1.a = t2.c and t2.b <> 1
+where t1.b <> 1 order by t1.a;
+
+drop table t1,t2;
| Thread |
|---|
| • bk commit into 5.0 tree (gkodinov:1.2167) BUG#18895 | kgeorge | 14 Jun |