diff --git a/dbcon/mysql/ha_mcs_execplan.cpp b/dbcon/mysql/ha_mcs_execplan.cpp index 81c5acd09..8ae75b42d 100755 --- a/dbcon/mysql/ha_mcs_execplan.cpp +++ b/dbcon/mysql/ha_mcs_execplan.cpp @@ -4088,7 +4088,20 @@ ReturnedColumn* buildFunctionColumn( fc->operationType(functor->operationType(funcParms, fc->resultType())); fc->expressionId(ci->expressionId++); - fc->charsetNumber(ifp->collation.collation->number); + // A few functions use a different collation than that found in + // the base ifp class + if (funcName == "locate" || + funcName == "find_in_set" || + funcName == "strcmp") + { + DTCollation dt; + ifp->Type_std_attributes::agg_arg_charsets_for_comparison(dt, ifp->func_name(), ifp->arguments(), 1, 1); + fc->charsetNumber(dt.collation->number); + } + else + { + fc->charsetNumber(ifp->collation.collation->number); + } } else if (ifp->type() == Item::COND_ITEM || ifp->functype() == Item_func::EQ_FUNC || diff --git a/utils/funcexp/func_strcmp.cpp b/utils/funcexp/func_strcmp.cpp index 743903f42..68584f705 100644 --- a/utils/funcexp/func_strcmp.cpp +++ b/utils/funcexp/func_strcmp.cpp @@ -74,7 +74,7 @@ int64_t Func_strcmp::getIntVal(rowgroup::Row& row, const string& str = fp[0]->data()->getStrVal(row, isNull); const string& str1 = fp[1]->data()->getStrVal(row, isNull); - int ret = cs->strnncoll(str.c_str(), str.length(), str1.c_str(), str1.length()); + int ret = cs->strnncollsp(str.c_str(), str.length(), str1.c_str(), str1.length()); // mysql's strcmp returns only -1, 0, and 1 return (ret < 0 ? -1 : (ret > 0 ? 1 : 0)); }