Bug #4131 TIMESTAMP columns missing minutes and seconds when using GROUP BY
Submitted: 14 Jun 2004 20:12 Modified: 26 Sep 2004 21:58
Reporter: matt roberts Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S2 (Serious)
Version:4.0.20 OS:Linux (Linux)
Assigned to: Dmitry Lenev CPU Architecture:Any

[14 Jun 2004 20:12] matt roberts
Description:
When using a GROUP BY 

How to repeat:
Here is a test to reproduce:

mysql> create table test (a char(2), t timestamp);
Query OK, 0 rows affected (2.21 sec)

mysql> insert into test values ('a', now());
Query OK, 1 row affected (0.00 sec)

mysql> insert into test values ('a', now());
Query OK, 1 row affected (0.00 sec)

mysql> insert into test values ('b', now());
Query OK, 1 row affected (0.00 sec)
mysql> select * from test;
+------+---------------------+
| a    | t                   |
+------+---------------------+
| a    | 2004-06-14 18:06:52 |
| a    | 2004-06-14 18:07:00 |
| b    | 2004-06-14 18:07:08 |
+------+---------------------+
3 rows in set (0.00 sec)

mysql> select max(t) from test group by a;
+----------------+
| max(t)         |
+----------------+
| 2004-06-14 18: |
| 2004-06-14 18: |
+----------------+
2 rows in set (0.00 sec)

See the missing minutes and seconds.

mysql> select max(t+0) from test group by a;
+----------------+
| max(t+0)       |
+----------------+
| 20040614180700 |
| 20040614180708 |
+----------------+
2 rows in set (0.00 sec)

Using this format shows the minutes and seconds.
[14 Jun 2004 20:14] matt roberts
It's GROUP BY, not order by...
[17 Jun 2004 20:09] Hartmut Holzgraefe
This happens when mysqld is started with the --new option, 
looks like some buffers have a size hardcoded to the old
YYYYMMDhhmmss format and cut off the rest of the longer
YYYY-MM-DD hh:mm:ss format.

4.1.1 does not show this error.
[26 Sep 2004 21:58] Dmitry Lenev
Thank you for your bug report. This issue has been committed to our
source repository of that product and will be incorporated into the
next release.

If necessary, you can access the source repository and build the latest
available version, including the bugfix, yourself. More information 
about accessing the source trees is available at
    http://www.mysql.com/doc/en/Installing_source_tree.html

Additional info:

Patch was reviewed and approved by Sanja and Konst at MaltaDevCon.

ChangeSet 1.1996.2.1 2004/09/27 00:50:00 dlenev@mysql.com
  Fix for bug #4131 "TIMESTAMP columns missing minutes and seconds when
  using GROUP BY"