from_unixtime and decimal to integer conversion

Bug #592690 reported by Brian Moon
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Drizzle
Fix Released
Medium
Brian Aker
7.0
Fix Released
Medium
Brian Aker

Bug Description

Drizzle Version: '2010.03.1347': (CDT Time Zone)

mysql> select from_unixtime(1272945599.90000), from_unixtime(1272945599), from_unixtime("1272945599.90000")\G
*************************** 1. row ***************************
  from_unixtime(1272945599.90000): 2010-05-03 23:00:00
        from_unixtime(1272945599): 2010-05-03 22:59:59
from_unixtime("1272945599.90000"): 2010-05-03 22:59:59
1 row in set, 1 warning (0.08 sec)

A) This generates a warning. Should be an error.
B) The warning says it "truncated" the value to an integer. In reality it rounded it.
C) Rounding it leads to an incorrect date/time.
D) Something is different about it being in quotes.
E) IMO, from_unixtime should take a decimal. date_format has the %u option for microseconds. How else can we have microseconds in a date_format if no date/time format in Drizzle supports them? Other than NOW() of course.

Related branches

Changed in drizzle:
assignee: nobody → Brian Aker (brianaker)
importance: Undecided → Medium
status: New → Confirmed
Revision history for this message
Brian Aker (brianaker) wrote :

So the problem here is that via SQL rules we should round up, and this is what causes this to happen (so it is legal).

Now the question is, should we use the right hand side of a decimal to determine fraction of seconds? I'd say this is ok, but I would probably call this a feature (and a nice one to have). Let me take a spin on it and see what I can see about it.

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.