From 7e9889768fce27f0fd31a5d0524c6d8c22a472b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=85=A8=E8=B6=85?= Date: Mon, 14 Oct 2024 15:54:51 +0800 Subject: [PATCH] fix bug-113304,#ebd201b07b74a6e37152e86ccf8eeb3ce13f158b,cmp_context not set caue zerofill number not convert to string in equal_fields_propagator method --- sql/item_func.cc | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/sql/item_func.cc b/sql/item_func.cc index 3d2142ab72c3..185b016af06c 100644 --- a/sql/item_func.cc +++ b/sql/item_func.cc @@ -708,6 +708,19 @@ Item *Item_func::compile(Item_analyzer analyzer, uchar **arg_p, to analyze any argument of the condition formula. */ uchar *arg_v = *arg_p; + // fix ebd201b07b74a6e37152e86ccf8eeb3ce13f158b + // bug-113304, equal_fields_propagator ,cmp_context == INVALID_RESULT + // cause zerofill number not convert to string + if ((*arg)->cmp_context == INVALID_RESULT && + (*arg)->real_item()->type() == FIELD_ITEM && + cmp_context == REAL_RESULT && data_type() == MYSQL_TYPE_BLOB) { + Item_field *field_item = (Item_field *)((*arg)->real_item()); + if (!field_item->no_constant_propagation && + field_item->field->is_flag_set(ZEROFILL_FLAG) && + IS_NUM(field_item->field->type())) { + (*arg)->cmp_context = STRING_RESULT; + } + } Item *new_item = (*arg)->compile(analyzer, &arg_v, transformer, arg_t); if (new_item == nullptr) return nullptr; if (*arg != new_item) current_thd->change_item_tree(arg, new_item);