Bug #46167 Misaligned column breaks in mysql result set
Submitted: 14 Jul 2009 13:54 Modified: 15 Aug 2009 7:02
Reporter: Randall Sparks Email Updates:
Status: No Feedback Impact on me:
None 
Category:MySQL Server: General Severity:S3 (Non-critical)
Version:5.0.18 OS:Linux
Assigned to: CPU Architecture:Any
Tags: misaligned column break results

[14 Jul 2009 13:54] Randall Sparks
Description:
Our MySQL database has a table with the following description:
 
PK   system_id              tinyint(3)
PK   timestamp             varchar(25)  (there's a reason for this)
       message_type_id   tinyint
       hex                       tinytext
 
A sample record might look like:
|system_id  | timestamp                 | message_type   | hex                                |
|1               |2009-07-12 00:03:57  | 2                      | 00 ff aa ef c1 a5 85 f1 a1 |
 
I have a query that renders in a very odd way to the web via PHP.  However, I think the problem is with MySQL.  When I run my query with the table joins the result set renders with mis-aligned columns.  Below is a brief example:
 
SQL:
select system_id,
          somestuff,
          message_type,
          hex,
          timestamp
from system s,
        ftable f,
        mtable mt,
        ttable t,
        infotable pi
where s.system_id = pi.system_id
  and  f.f_id = pi.f_id
  and  mt.mt_id = pi.mt_id
  and  t.t_id = pi.t_id
  and s.system in ('abc', 'def')
  and f.stuff in ('xyz','zyx')
  and mt.stuff in ('lbj','rfk')
  and pi.timestamp between (some time) and (some later time)
order by pi.timestamp desc,
             s.system asc;
 
I had to be a bit vague but I think you'll get the idea.  The following will show my problem:
 
The rendered result set looks like this:
 
+-----------------------+---------------------+---------------------+------------------------------------------------+-------------------------+
| system                   | somestuff            | message_type     | hex                                                      | timestamp                |
+-----------------------+---------------------+---------------------+------------------------------------------------+-------------------------+
| abc                        | xyz                      | lbj                     | 00 ff aa ef f1 a5 8f f1 a1 00 ef aa  | 2009-07-12 00:03:57  |
 
 
Do you see how the rendered column breaks between hex and timestamp don't line up?  Why is MySQL doing that?  The problem then translates to our web page.  The rendered output on the web is displaying the following goofy characters:
following the last hex value, is a "square" with "00" and "1B" enclosed within the square.  This is followed by "[0m"  If I can ascii'fy this below it looks like:
 
blah blah blah   00 ff aa ef f1 a5 8f f1 a1 00 ef aa |00|[0m
                                                                        |1B|
 
Anyhow, do you have any ideas?

How to repeat:
Bug can be repeated by setting up the tables/data and running the query as described.
[14 Jul 2009 13:55] Randall Sparks
The line wrap of this forum destroys my intended look.
[14 Jul 2009 17:45] Randall Sparks
Additional information follows:
The timestamp value in this table is of the form yyy-mm-dd hh:mm:ss.f
When the timestamp value is referenced in any form the misalignment occurs.  Simply displaying the timestamp does not alter the hex column, but an "order by" and a "timestamp > or <" causes the misalignment.  The odd thing is that the misalignment occurst to the hex column and not to the timestamp column.
[15 Jul 2009 7:02] Sveta Smirnova
Thank you for the report.

But version 5.0.18 is old and at least one rendering bug was fixed since. Please upgrade to current version 5.0.83 and if problem still exists provide image screenshot of the problem.
[15 Aug 2009 23:00] Bugs System
No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".