Bug #534 table names become case sensitive with complex queries
Submitted: 29 May 2003 7:15 Modified: 31 May 2003 8:42
Reporter: Stephen Dakin Email Updates:
Status: Closed Impact on me:
Category:MySQL Server Severity:S1 (Critical)
Version:4.0.12 OS:Microsoft Windows (Win 2000)
Assigned to: Michael Widenius

[29 May 2003 7:15] Stephen Dakin
with complex queries we have noticed case sensitibity becoming an issue with table names.

How to repeat:

SELECT COUNT(DISTINCT Bags.tag) FROM  bags LEFT OUTER JOIN deliveries ON bags.tag = deliveries.bagtag

SELECT COUNT(DISTINCT Bags.tag) FROM  Bags LEFT OUTER JOIN Deliveries ON Bags.tag = Deliveries.bagtag
[29 May 2003 7:48] Miguel Solorzano
Could you please send a test case for to verify the errors
in your queries.
[31 May 2003 8:42] Michael Widenius
Thank you for your bug report. This issue has been fixed in the latest
development tree for that product. You can find more information about
accessing our development trees at 

The problem here is that alias in MySQL are case senstive (as described in the manual).

When you do
SELECT Bugs.a FROM bugs

MySQL will automaticly create an alias of bugs as 'bugs' and this will not be equal with the 'Bugs' in the SELECT part.

In the manual, you can find more information about this in the section:

I have now fixed this in the 4.1 tree so that alias will also be compared case insensitive if --lower-table-names are set (which is default on windows)