from_unixtime and decimal to integer conversion
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(
*******
from_
from_unixtime(
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
- Lee Bieber (community): Needs Fixing
-
Diff: 4508 lines (+1331/-843)82 files modifieddrizzled/calendar.cc (+13/-29)
drizzled/calendar.h (+0/-1)
drizzled/error.cc (+1/-0)
drizzled/error_t.h (+12/-10)
drizzled/field.cc (+10/-8)
drizzled/field.h (+4/-4)
drizzled/field/date.cc (+14/-11)
drizzled/field/date.h (+1/-1)
drizzled/field/datetime.cc (+5/-5)
drizzled/field/datetime.h (+1/-1)
drizzled/field/decimal.cc (+1/-1)
drizzled/field/decimal.h (+1/-1)
drizzled/field/epoch.cc (+32/-27)
drizzled/field/epoch.h (+7/-4)
drizzled/field/microtime.cc (+63/-54)
drizzled/field/microtime.h (+4/-2)
drizzled/field/time.cc (+4/-4)
drizzled/field/uuid.cc (+3/-14)
drizzled/function/cast/time.cc (+4/-3)
drizzled/function/time/curdate.cc (+1/-1)
drizzled/function/time/date.cc (+4/-4)
drizzled/function/time/date_add_interval.cc (+4/-4)
drizzled/function/time/date_format.cc (+15/-15)
drizzled/function/time/from_unixtime.cc (+25/-21)
drizzled/function/time/makedate.cc (+4/-2)
drizzled/function/time/now.cc (+15/-25)
drizzled/function/time/now.h (+1/-1)
drizzled/function/time/sysdate_local.cc (+9/-5)
drizzled/function/time/typecast.cc (+12/-5)
drizzled/item.cc (+38/-32)
drizzled/item/cmpfunc.cc (+4/-5)
drizzled/plugin/client.cc (+6/-5)
drizzled/session.h (+5/-5)
drizzled/sql_yacc.yy (+1/-1)
drizzled/temporal.cc (+19/-18)
drizzled/temporal_interval.cc (+2/-3)
drizzled/time_functions.cc (+43/-75)
drizzled/time_functions.h (+5/-16)
drizzled/type/decimal.cc (+7/-1)
drizzled/type/decimal.h (+88/-83)
drizzled/type/time.cc (+174/-114)
drizzled/type/time.h (+102/-38)
drizzled/tztime.cc (+13/-18)
drizzled/tztime.h (+9/-17)
drizzled/util/gmtime.cc (+284/-0)
drizzled/util/gmtime.h (+46/-0)
drizzled/util/include.am (+2/-0)
plugin/csv/tests/t/uuid_type.test (+1/-1)
plugin/haildb/tests/r/type_timestamp.result (+3/-3)
plugin/haildb/tests/t/type_timestamp.test (+3/-3)
plugin/memory/tests/t/primary_key.test (+1/-1)
plugin/myisam/tests/r/mix2_myisam.result (+6/-4)
plugin/transaction_log/tests/r/transaction_log_data_type.result (+26/-27)
plugin/transaction_log/tests/t/transaction_log_data_type.test (+4/-5)
tests/include/mix2.inc (+6/-5)
tests/r/data_dictionary_like_info.result (+2/-2)
tests/r/func_time.result (+65/-62)
tests/r/information_schema.result (+1/-1)
tests/r/insert.result (+1/-1)
tests/r/parser.result (+1/-1)
tests/r/timezone.result (+3/-2)
tests/r/type_datetime.result (+2/-2)
tests/r/type_timestamp.result (+3/-3)
tests/suite/microtime_type/r/basic.result (+3/-3)
tests/suite/microtime_type/r/decimal.result (+19/-0)
tests/suite/microtime_type/r/max.result (+8/-0)
tests/suite/microtime_type/t/basic.test (+3/-3)
tests/suite/microtime_type/t/decimal.test (+17/-0)
tests/suite/microtime_type/t/max.test (+10/-0)
tests/suite/regression/r/592690.result (+3/-0)
tests/suite/regression/t/592690.test (+2/-0)
tests/suite/uuid_type/t/insert_null_no_key.test (+1/-1)
tests/suite/uuid_type/t/primary_key.test (+1/-1)
tests/t/func_time.test (+6/-6)
tests/t/insert.test (+1/-1)
tests/t/timezone.test (+1/-1)
tests/t/type_timestamp.test (+3/-3)
unittests/calendar_test.cc (+1/-1)
unittests/micro_timestamp_test.cc (+1/-1)
unittests/nano_timestamp_test.cc (+1/-1)
unittests/plugin/client_test.cc (+3/-3)
unittests/timestamp_test.cc (+1/-1)
Changed in drizzle: | |
assignee: | nobody → Brian Aker (brianaker) |
importance: | Undecided → Medium |
status: | New → Confirmed |
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.