summaryrefslogtreecommitdiff
path: root/sql/field.cc
diff options
context:
space:
mode:
authorAlexander Barkov <bar@mariadb.com>2021-10-14 08:37:23 +0400
committerAlexander Barkov <bar@mariadb.com>2021-10-14 08:37:23 +0400
commitdf383043427fb22b0735fe31968db860f4cdb7a0 (patch)
tree570ba7b6afad8b97e4d4fc03d555df9bcecc0dd7 /sql/field.cc
parentbd1573b0f332d4c7c08aab2974aadd544dbc24e3 (diff)
downloadmariadb-git-bb-10.5-bar-MDEV-26742.tar.gz
MDEV-26742 Assertion `field->type_handler() == this' failed in FixedBinTypeBundle<NATIVE_LEN, MAX_CHAR_LEN>::Type_handler_fbt::stored_field_cmp_to_itembb-10.5-bar-MDEV-26742
Diffstat (limited to 'sql/field.cc')
-rw-r--r--sql/field.cc19
1 files changed, 17 insertions, 2 deletions
diff --git a/sql/field.cc b/sql/field.cc
index 7ff07540538..2c768527ced 100644
--- a/sql/field.cc
+++ b/sql/field.cc
@@ -1276,6 +1276,21 @@ bool Field::can_be_substituted_to_equal_item(const Context &ctx,
}
+bool Field::cmp_is_done_using_type_handler_of_this(const Item_bool_func *cond,
+ const Item *item) const
+{
+ /*
+ We could eventually take comparison_type_handler() from cond,
+ instead of calculating it again. But only some descendants of
+ Item_bool_func has this method. So this needs some hierarchy changes.
+ Another option is to pass "class Context" to this method.
+ */
+ Type_handler_hybrid_field_type cmp(type_handler_for_comparison());
+ return !cmp.aggregate_for_comparison(item->type_handler_for_comparison()) &&
+ cmp.type_handler() == type_handler_for_comparison();
+}
+
+
/*
This handles all numeric and BIT data types.
*/
@@ -7356,7 +7371,7 @@ bool
Field_longstr::cmp_to_string_with_same_collation(const Item_bool_func *cond,
const Item *item) const
{
- return item->cmp_type() == STRING_RESULT &&
+ return cmp_is_done_using_type_handler_of_this(cond, item) &&
charset() == cond->compare_collation();
}
@@ -7365,7 +7380,7 @@ bool
Field_longstr::cmp_to_string_with_stricter_collation(const Item_bool_func *cond,
const Item *item) const
{
- return item->cmp_type() == STRING_RESULT &&
+ return cmp_is_done_using_type_handler_of_this(cond, item) &&
(charset() == cond->compare_collation() ||
cond->compare_collation()->state & MY_CS_BINSORT);
}