diff options
author | Alexander Barkov <alexander.barkov@oracle.com> | 2011-02-18 10:32:40 +0300 |
---|---|---|
committer | Alexander Barkov <alexander.barkov@oracle.com> | 2011-02-18 10:32:40 +0300 |
commit | 498ff4468d67499eb35e5c7d0014f935523e0158 (patch) | |
tree | 96b1ff283e298e247c9c12941f453ac85b10078d /sql/item_cmpfunc.cc | |
parent | 782176af297d75a8decaaa5db9d621f79a720e87 (diff) | |
download | mariadb-git-498ff4468d67499eb35e5c7d0014f935523e0158.tar.gz |
Bug#60101 COALESCE with cp1251 tables causes [Err] 1267 - Illegal mix of collations
Problem:
IF() did not copy collation derivation and repertoire from
an argument if the opposite argument was NULL:
IF(cond, res1, NULL)
IF(cond, NULL, res2)
only CHARSET_INFO pointer was copied.
This resulted in illegal mix of collations error.
Fix:
copy all collation parameters from the non-NULL argument:
CHARSET_INFO pointer, derivation, repertoire.
Diffstat (limited to 'sql/item_cmpfunc.cc')
-rw-r--r-- | sql/item_cmpfunc.cc | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc index 67635c73b43..df541f603ee 100644 --- a/sql/item_cmpfunc.cc +++ b/sql/item_cmpfunc.cc @@ -2640,7 +2640,7 @@ Item_func_if::fix_length_and_dec() if (null1) { cached_result_type= arg2_type; - collation.set(args[2]->collation.collation); + collation.set(args[2]->collation); cached_field_type= args[2]->field_type(); max_length= args[2]->max_length; return; @@ -2649,7 +2649,7 @@ Item_func_if::fix_length_and_dec() if (null2) { cached_result_type= arg1_type; - collation.set(args[1]->collation.collation); + collation.set(args[1]->collation); cached_field_type= args[1]->field_type(); max_length= args[1]->max_length; return; |