Commit 203bc9ec authored by unknown's avatar unknown

item_func.cc:

  Fix for coercibility of function


sql/item_func.cc:
  Fix for coercibility of function
parent aed2e289
......@@ -122,10 +122,29 @@ Item_func::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref)
Set return character set to first argument if we are returning a
string.
*/
if (args == arg)
set_charset(args[0]->charset());
else if ((*arg)->binary() || (charset() != (*arg)->charset()) )
if ((*arg)->binary())
{
set_charset(&my_charset_bin);
coercibility= COER_NOCOLL;
}
else if (coercibility== COER_NOCOLL)
{
coercibility= (*arg)->coercibility;
set_charset((*arg)->charset());
}
else if ((*arg)->coercibility > coercibility)
{
if (strcmp(charset()->csname,(*arg)->charset()->csname))
{
set_charset(&my_charset_bin);
coercibility= COER_NOCOLL;
}
else
{
coercibility= (*arg)->coercibility;
set_charset((*arg)->charset());
}
}
}
with_sum_func= with_sum_func || (*arg)->with_sum_func;
used_tables_cache|=(*arg)->used_tables();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment