Bug #18265 mysql client: No longer right-justifies numeric columns
Submitted: 15 Mar 2006 22:29 Modified: 11 Apr 2006 21:00
Reporter: Paul DuBois Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Command-line Clients Severity:S3 (Non-critical)
Version:5.0.19, 5.1.8 OS:
Assigned to: Chad MILLER CPU Architecture:Any

[15 Mar 2006 22:29] Paul DuBois
Description:
The mysql client formerly right-justified numeric column
values.  This no longer occurs, making numeric columns
more difficult to understand.

How to repeat:
Test input:

drop table if exists t;
create table t (i int, d decimal(10,2), f float);
insert into t (i,d,f)
values
(1,1,1),
(21,21,21),
(321,321,321),
(4321,4321,4321),
(54321,54321,54321);
select
i as 'integer value',
d as 'decimal value',
f as 'float value'
from t;

Good results in 5.0 before 5.0.19 and in 5.1 before 5.1.8:

+---------------+---------------+-------------+
| integer value | decimal value | float value |
+---------------+---------------+-------------+
|             1 |          1.00 |           1 |
|            21 |         21.00 |          21 |
|           321 |        321.00 |         321 |
|          4321 |       4321.00 |        4321 |
|         54321 |      54321.00 |       54321 |
+---------------+---------------+-------------+

Bad results in 5.0 as of 5.0.19 and in 5.1 as of 5.1.8:

+---------------+---------------+-------------+
| integer value | decimal value | float value |
+---------------+---------------+-------------+
| 1             | 1.00          | 1           |
| 21            | 21.00         | 21          |
| 321           | 321.00        | 321         |
| 4321          | 4321.00       | 4321        |
| 54321         | 54321.00      | 54321       |
+---------------+---------------+-------------+

Suggested fix:
Please restore previous behavior for numeric columns.
[4 Apr 2006 18:51] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/4456
[4 Apr 2006 19:25] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/4457
[4 Apr 2006 21:35] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/4462
[7 Apr 2006 17:06] Ian Greenhoe
Patch looks good to me.
[10 Apr 2006 14:45] Magnus BlÄudd
Patch ok for me too.
[11 Apr 2006 20:51] Chad MILLER
Patch applies to 5.0.21 and 5.1.10.

There were two bugs here, cause by the same "ASCII-zero" change of a few versions ago:  Not right-justifying numbers and not printing "NULL".  This single patch restores both.
[11 Apr 2006 21:00] Paul DuBois
Noted in 5.0.21, 5.1.10 changelogs.

A recent change caused the <command>mysql</command> client not
to display <literal>NULL</literal> values correctly and to
display numeric columns left-justified rather than
right-justified. The problems have been corrected. (Bug #18265)
[20 Apr 2006 17:23] MySQL Verification Team
Bug http://bugs.mysql.com/bug.php?id=19228 it was closed
with reference of this one.
[24 Apr 2006 23:04] MySQL Verification Team
Bug: http://bugs.mysql.com/bug.php?id=19306 marked as duplicate
of this one.