Bug #18645 ResultSet.getString() returns a byte array for GROUP_CONCAT()
Submitted: 30 Mar 2006 10:30 Modified: 30 Mar 2006 12:04
Reporter: Nathan Cheng Email Updates:
Status: Duplicate Impact on me:
None 
Category:Connector / J Severity:S3 (Non-critical)
Version:MySQL 4.1.13 + Connector 3.1.12 OS:Linux (RedHat Linux)
Assigned to: CPU Architecture:Any

[30 Mar 2006 10:30] Nathan Cheng
Description:
Actually, getString() is returning the toString() version of the byte[], so stuff like "[B@77a748". It is definitely trying to return a byte array -- I have tested it by verifying the true-ness of this expression:

   ResultSet.getObject(...) instanceof byte[]

The query in question is rather complex (and proprietary), so here is just the field definition with the GROUP_CONCAT expression:

GROUP_CONCAT( DISTINCT k.source ORDER BY k.created DESC SEPARATOR ', ' ) AS the_source

The "k" table is made up of varchars, chars, ints, and one TEXT column. The k.source column is defined thus:

  `source` varchar(128) default NULL,

And k.created thus:

  `created` int(10) unsigned NOT NULL default '0',

The group by/order by expressions look like this:

GROUP BY a.contact_id, f.staff_id, dcv.contact_vehicle_id 

ORDER BY a.original_created DESC, b.last_name DESC, b.first_name DESC, a.contact_id DESC, k_created DESC, f.staff_id DESC

How to repeat:
I have no idea how to repeat this in a simple test case, but when I remove the GROUP_CONCAT expression and just pick a random k.source, everything works fine (i.e. getString("source") returns a proper String instead of gobbly-gook).
[30 Mar 2006 12:04] Valeriy Kravchuk
Thank you for a problem report. I think, the real reason for your problem is described in bug #18281, so I'll mark this report as a duplicate of that one.