1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-01 03:47:19 +03:00

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.
This commit is contained in:
Alexander Barkov
2011-02-18 10:32:40 +03:00
parent 1715327630
commit 0db53b19b7
3 changed files with 27 additions and 2 deletions

View File

@ -85,6 +85,16 @@ set global LC_TIME_NAMES=convert((-8388608) using cp1251);
--source include/ctype_numconv.inc
--echo #
--echo # Bug#60101 COALESCE with cp1251 tables causes [Err] 1267 - Illegal mix of collations
--echo #
CREATE TABLE t1 (test1 INT, test2 VARCHAR(255));
SHOW CREATE TABLE t1;
SELECT COALESCE(IF(test1=1, 1, NULL), test2) FROM t1;
SELECT COALESCE(IF(test1=1, NULL, 1), test2) FROM t1;
DROP TABLE t1;
--echo #
--echo # End of 5.5 tests
--echo #