Bug #10892 user variables not auto cast for comparisons
Submitted: 26 May 2005 23:27 Modified: 14 Aug 2005 2:25
Reporter: Matthew Lord
Status: Closed
Category:Server Severity:S3 (Non-critical)
Version:4.1.12 OS:Any (all)
Assigned to: Alexander Barkov Target Version:

[26 May 2005 23: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 2:12] Miguel Solorzano
Verified on Slackware Linux BK source.
[4 Aug 2005 12: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 15:34] Alexander Barkov
Fixed in 4.1.14 and 5.0.12
[14 Aug 2005 2:25] Paul DuBois
Noted in 4.1.14, 5.0.12 changelogs.