Details
-
Improvement
-
Status: Closed
-
Minor
-
Resolution: Fixed
-
1.5.7
-
None
-
Connecting to MySQL 5 with Connector/J 5.1+
Description
I had a problem when joining two tables that shared a field name, ie:
SELECT a.id, a.description, b.description FROM a JOIN b ON( a.b_fk = b.id )
As both fields get put into the save field in the resultant row map.
Trying to alias the rows doesn't help, ie;
SELECT a.id, a.description AS a_desc, b.description AS b_desc FROM a JOIN b ON( a.b_fk = b.id )
Gives the same.
I found the reason for this ( http://jira.codehaus.org/browse/GROOVY-2782) which recommends adding the "useOldAliasMetadataBehavior=true" parameter to the JDBC url, and this does fix it, however in that issue, Ken Weiner asks:
>> Should the rows method be calling ResultSetMetaData.getColumnLabel() instead?
Which I thought was a good point, deserving of another issue.
It's strange, and kinda unpredictable as it stands, as the following:
SELECT 10, 10 AS ten
Does give you two columns back (so the alias works) – but I guess this is a missed case on the original MySQL "fix"
Hope this make sense... It's my first issue, and I've tried not to babble
Cheers,
Tim
Attachments
Attachments
Issue Links
- is related to
-
GROOVY-2782 SQL column aliases not recognized by groovy.sql methods
- Closed