select date(from_unixtime(int)) incorrectly returns 0000-00-00

Bug #814622 reported by Robert Adams
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
InfiniDB Community
Fix Released
Undecided
Unassigned

Bug Description

0000-00-00s are incorrect below:

create table test.ts (ts int(10))engine=infinidb;
insert into test.ts values(1302204355);
insert into test.ts values(1271117500);
insert into test.ts values(1302033274);

mysql> select ts, from_unixtime(ts), date(from_unixtime(ts)) d from test.ts;
+------------+---------------------+------------+
| ts | from_unixtime(ts) | d |
+------------+---------------------+------------+
| 1302204355 | 2011-04-07 14:25:55 | 0000-00-00 |
| 1271117500 | 2010-04-12 19:11:40 | 0000-00-00 |
| 1302033274 | 2011-04-05 14:54:34 | 0000-00-00 |
+------------+---------------------+------------+
3 rows in set, 3 warnings (0.03 sec)

Changed in infinidb:
status: New → In Progress
Revision history for this message
Robert Adams (radams-calpont) wrote :

Work around

mysql> alter table ts add column dtm datetime;
Query OK, 0 rows affected (0.67 sec)
Records: 0 Duplicates: 0 Warnings: 0

mysql> update ts set dtm=from_unixtime(ts);
Query OK, 3 rows affected (0.32 sec)
Rows matched: 0 Changed: 0 Warnings: 0

mysql> select * from ts;
+------------+---------------------+
| ts | dtm |
+------------+---------------------+
| 1302204355 | 2011-04-07 14:25:55 |
| 1271117500 | 2010-04-12 19:11:40 |
| 1302033274 | 2011-04-05 14:54:34 |
+------------+---------------------+
3 rows in set (0.10 sec)

mysql> select ts, from_unixtime(ts), date(from_unixtime(ts)) d,
mysql> date(dtm) dt
from ts;
+------------+---------------------+------------+------------+
| ts | from_unixtime(ts) | d | dt |
+------------+---------------------+------------+------------+
| 1302204355 | 2011-04-07 14:25:55 | 0000-00-00 | 2011-04-07 |
| 1271117500 | 2010-04-12 19:11:40 | 0000-00-00 | 2010-04-12 |
| 1302033274 | 2011-04-05 14:54:34 | 0000-00-00 | 2011-04-05 |
+------------+---------------------+------------+------------+
3 rows in set, 3 warnings (0.03 sec)

Revision history for this message
Robert Adams (radams-calpont) wrote :

Corrected and packaged in the 2.2.1 release.

Changed in infinidb:
status: In Progress → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.