diff options
author | Sergey Glukhov <Sergey.Glukhov@sun.com> | 2009-02-19 17:20:44 +0400 |
---|---|---|
committer | Sergey Glukhov <Sergey.Glukhov@sun.com> | 2009-02-19 17:20:44 +0400 |
commit | c2e23208ef7ae6b315ca4988e903bff2bc0284d4 (patch) | |
tree | 8d8120d61f551e8a1f07b2653737f3d6d001949c /sql/item_cmpfunc.cc | |
parent | 0c96241b156ef044e8d73a31e98918a721597126 (diff) | |
download | mariadb-git-c2e23208ef7ae6b315ca4988e903bff2bc0284d4.tar.gz |
Bug#37601 Cast Is Not Done On Row Comparison
In case of ROW item each compared pair does not
check if argumet collations can be aggregated and
thus appropiriate item conversion does not happen.
The fix is to add the check and convertion for ROW
pairs.
mysql-test/r/row.result:
test result
mysql-test/t/row.test:
test case
sql/item.cc:
added agg_item_set_converter() function which was a part of
agg_item_charsets() func. The only difference is that
agg_item_set_converter() checks and converts items
using already known collation.
sql/item.h:
added agg_item_set_converter() function
sql/item_cmpfunc.cc:
In case of ROW item each compared pair does not
check if argumet collations can be aggregated and
thus appropiriate item conversion does not happen.
The fix is to add the check and convertion for ROW
pairs.
Diffstat (limited to 'sql/item_cmpfunc.cc')
-rw-r--r-- | sql/item_cmpfunc.cc | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc index 3b1d18b4252..01d3e9bed52 100644 --- a/sql/item_cmpfunc.cc +++ b/sql/item_cmpfunc.cc @@ -490,7 +490,8 @@ int Arg_comparator::set_compare_func(Item_bool_func2 *item, Item_result type) my_error(ER_OPERAND_COLUMNS, MYF(0), (*a)->element_index(i)->cols()); return 1; } - comparators[i].set_cmp_func(owner, (*a)->addr(i), (*b)->addr(i)); + if (comparators[i].set_cmp_func(owner, (*a)->addr(i), (*b)->addr(i))) + return 1; } break; } @@ -835,6 +836,16 @@ int Arg_comparator::set_cmp_func(Item_bool_func2 *owner_arg, get_value_func= &get_time_value; return 0; } + else if (type == STRING_RESULT && + (*a)->result_type() == STRING_RESULT && + (*b)->result_type() == STRING_RESULT) + { + DTCollation coll; + coll.set((*a)->collation.collation); + if (agg_item_set_converter(coll, owner_arg->func_name(), + b, 1, MY_COLL_CMP_CONV, 1)) + return 1; + } return set_compare_func(owner_arg, type); } |