Bug #16567381 DATETIME FIELD COMPARISONS DO NOT WORK PROPERLY
WITH UTF8_UNICODE_CI COLLATION Problem Description: When comparing datetime values with strings, the utf8_unicode_ci collation prevents correct comparisons. Consider the below set of queries, it is not showing any results on a table which has tuples that satisfies the query. But for collation utf8_general_ci it shows one tuple. set names utf8 collate utf8_unicode_ci;; select * from lang where dt='1979-12-09'; Analysis: The comparison function is not chosen in case of collation utf8_unicode_ci. In agg_item_set_converter() because the collation state is having "MY_CS_NONASCII" for collation type "utf8_unicode_ci". The conversion of the collation is happening for the date field. And because of that it is unable to pickup proper compare function(i.e CMP_DATE_WITH_STR). Actually the bug is accidentally introduced by the WL#3759 in 5.5. And in 5.6 it is been fixed by the WL#3664. Fix: I have backported the changes from the file strings/ctype-uca.c which are related to "utf8" introduced by the WL#3664. This change helps in choosing the correct comparison function for all the collations of utf8 charset.
Showing
Please register or sign in to comment