Bug #14789 Aliased column names are not preserved in select statements.
Submitted: 9 Nov 2005 15:34 Modified: 11 Nov 2005 11:37
Reporter: Anthony Milbourne Email Updates:
Status: Duplicate Impact on me:
None 
Category:Connector / J Severity:S2 (Serious)
Version:3.1.11 OS:Windows (Windows XP)
Assigned to: CPU Architecture:Any

[9 Nov 2005 15:34] Anthony Milbourne
Description:
I am using Connector/J 3.1.11 to connect to MySQL 5.0.15 under JDK 1.5.0-b64 on Windows XP.

When I pass SQL something like:

select id, colname as alias1, colname as alias2 from tabname;

I get back a ResultSet with the correct results but the names of the columns seem to be broken.  The ResultSet thinks they are called:

id, alias2, alias2 (when it should be id, alias1, alias2).

This breaks the SQL generated by Hibernate (this SQL runs fine using the Oracle driver) with a "SQLException: Column 'alias1' not found.".

How to repeat:
The problem can be seen quite easily in a tool such as Squirrel, which displays the wrong column names when it displays the results.
[11 Nov 2005 11:37] Anthony Milbourne
This seems to be a bug with the server its self - rather than with Connector/J.

I have oppened a new bug with more info and hence I am marking this as a duplicate.

the new bug is bug #14861.