Bug #37038 JDBC connector v 5.1.6 ignores SQL alias and returns actual field name instead
Submitted: 28 May 2008 12:33 Modified: 28 May 2008 12:47
Reporter: Chris Kobrzak Email Updates:
Status: Duplicate Impact on me:
None 
Category:Connector / J Severity:S2 (Serious)
Version:5.1.6 OS:Linux (Ubuntu 8.04, connector used by BlueDragon JX 7.0.1)
Assigned to: CPU Architecture:Any

[28 May 2008 12:33] Chris Kobrzak
Description:
I have a simple SELECT query including an SQL alias, e.g.

SELECT sourceObjectId AS category_id FROM relatedobjects

The query object returned has a field called sourceObjectID which means the alias has been ignored as you'd expect a column labeled "category_id" instead.

The JDBC connector is used by a piece of software called BlueDragon JX which is a CFML (ColdFusion) language parser and server.  I'm sure there's nothing wrong with BlueDragon itself as after replacing the driver with version 5.0.8 everything works fine - I get a "category_id" record as expected.

Database version: 5.0.51a-log Source distribution running on Fedora 8.

How to repeat:
Create a table with one varchar field and run a simple SELECT query using an alias as described above.

Suggested fix:
Replacing JDBC 5.1.6 with 5.0.8
[28 May 2008 12:47] Tonci Grgin
Please do not submit the same bug more than once. An existing bug report already describes this very problem. Even if you feel that your issue is somewhat different, the resolution is likely
to be the same. Because of this, we hope you add your comments to the original bug instead.

Thank you for your interest in MySQL.

Explanation: Hi Chris and thanks for your report. I'm declaring it to be a duplicate of Bug#35150 although I could have said Bug#35753 (partially) or Bug#35610 and many many more. Please, next time, search bugsdb as you'll likely find solution/explanation of your problem.