Bug #10892 user variables not auto cast for comparisons
Submitted: 26 May 2005 21:27 Modified: 14 Aug 2005 0:25
Reporter: Matthew Lord Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:4.1.12 OS:Any (all)
Assigned to: Alexander Barkov CPU Architecture:Any

[26 May 2005 21:27] Matthew Lord
Description:
User variables are not automatically cast for comparisons which causes queries to fail if the column and connection charsets differ.

How to repeat:
Start mysql with the default character sets (latin1).

set @user="foo";
select * from mysql.db where user=@user;

Suggested fix:
Give user variables less precedence than the column and auto cast the variable to the charset of the column for the comparison.
[27 May 2005 0:12] MySQL Verification Team
Verified on Slackware Linux BK source.
[4 Aug 2005 10:29] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/internals/27885
[8 Aug 2005 13:34] Alexander Barkov
Fixed in 4.1.14 and 5.0.12
[14 Aug 2005 0:25] Paul DuBois
Noted in 4.1.14, 5.0.12 changelogs.