summaryrefslogtreecommitdiff
path: root/sql/field.h
diff options
context:
space:
mode:
authorunknown <gkodinov@mysql.com>2006-06-14 15:57:23 +0300
committerunknown <gkodinov@mysql.com>2006-06-14 15:57:23 +0300
commit89ce81ceedc465115cafd39f29a05689a6da7205 (patch)
tree9bc88f4c90a2f5b771ff2124ca18c4cba6c1eda9 /sql/field.h
parent86334edf2e37bf69ec601b9b7d419587316dc424 (diff)
downloadmariadb-git-89ce81ceedc465115cafd39f29a05689a6da7205.tar.gz
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(). mysql-test/r/select.result: Bug #18895: BIT values cause joins to fail - test case mysql-test/t/select.test: Bug #18895: BIT values cause joins to fail - test case sql/field.h: Bug #18895: BIT values cause joins to fail - eq() method overloaded for Field_bit
Diffstat (limited to 'sql/field.h')
-rw-r--r--sql/field.h9
1 files changed, 8 insertions, 1 deletions
diff --git a/sql/field.h b/sql/field.h
index f4d27e46877..e7b7aa45c27 100644
--- a/sql/field.h
+++ b/sql/field.h
@@ -124,7 +124,7 @@ public:
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);
@@ -1358,6 +1358,13 @@ public:
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);
+ }
};