Bug #27534 | Illegal mix of collations (utf8) and (latin1) for nested functions and table col | ||
---|---|---|---|
Submitted: | 29 Mar 2007 18:58 | Modified: | 22 Jun 2007 5:52 |
Reporter: | Jamie Maher | Email Updates: | |
Status: | Duplicate | Impact on me: | |
Category: | MySQL Server: Charsets | Severity: | S2 (Serious) |
Version: | 5.0.37-community-nt, 5.0.36-enterprise | OS: | Linux (Linux, Windows 2000 pro) |
Assigned to: | Assigned Account | CPU Architecture: | Any |
Tags: | bfsm_2007_06_21, Collations, Illegal, mix, Mysql 5, query browser, regression |
[29 Mar 2007 18:58]
Jamie Maher
[29 Mar 2007 20:23]
Jamie Maher
Perhaps better examples would be: fine: "select IF(a = 'bar',IF('foo'='foo','truefoo','test1'),a) from t1;" fine: "select IF(a = 'bar',IF(b='foo',b,'test1'),a) from t1;" fine: "select IF(a = 'bar','truefoo',a) from t1;" fine: "select IF(b = 'foo','truefoo','test1') from t1;" error: "select IF(a = 'bar',IF(b='foo','truefoo','test1'),a) from t1;"
[29 Mar 2007 20:31]
Jamie Maher
An old instance of MySQL 4.0.23 that I have executes the query successfully: "select IF(a = 'bar',IF(b='foo','truefoo','test1'),a) from t1;" results: 'truefoo'
[30 Mar 2007 9:00]
Sveta Smirnova
Thank you for the report. Verified as described. Only community version is affected.
[6 Jun 2007 20:18]
Jamie Maher
Is there a target version yet that this will be fixed in?
[8 Jun 2007 8:18]
Axel Schwenke
This now also affects a customer: replication slave (5.0.42) behaves different than master (5.0.28) and thus replication breaks. Simplified testcase: \C latin1 drop table if exists t1, t2; create table t1 (c1 date); create table t2 (c2 char(7)); insert into t1 values ('2007-01-02'), ('2007-02-03'); insert into t2 values ('2007/01'); select * from t1, t2 where date_format(t1.c1, '%Y/%m') <= t2.c2; \C utf8 select * from t1, t2 where date_format(t1.c1, '%Y/%m') <= t2.c2; The last SELECT fails for 5.0.36 and later but works in previous versions (tested with 5.0.28 and 5.0.34). This is a REGRESSION bug!
[8 Jun 2007 8:29]
Axel Schwenke
I just noticed that the charset of the result of DATE_FORMAT() changed in 5.0.36 to be @character_set_connection (before: BINARY) and thus the comparison fails. But IMHO the coercibility of the DATE_FORMAT() result should be 4 (like a literal) and thus the comparison should be done using charset and collation from t2.c2.
[22 Jun 2007 5:51]
Alexander Barkov
This is a duplicate report with the bug#28875: http://bugs.mysql.com/bug.php?id=28875