MySQL Lists are EOL. Please join:

List:Commits« Previous MessageNext Message »
From:ramil Date:May 2 2006 1:00pm
Subject:bk commit into 4.1 tree (ramil:1.2474) BUG#16546
View as plain text  
Below is the list of changes that have just been committed into a local
4.1 repository of ram. When ram does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet
  1.2474 06/05/02 18:00:44 ramil@stripped +4 -0
  Fix for bug #16546: DATETIME+0 not always coerced the same way

  sql/item_timefunc.h
    1.57 06/05/02 18:00:32 ramil@stripped +1 -0
    Fix for bug #16546: DATETIME+0 not always coerced the same way
      - set decimals to DATETIME_DEC

  sql/item_timefunc.cc
    1.99 06/05/02 18:00:32 ramil@stripped +3 -3
    Fix for bug #16546: DATETIME+0 not always coerced the same way
      - set decimals to DATETIME_DEC

  mysql-test/t/func_time.test
    1.33 06/05/02 18:00:32 ramil@stripped +8 -0
    Fix for bug #16546: DATETIME+0 not always coerced the same way
      - test case

  mysql-test/r/func_time.result
    1.38 06/05/02 18:00:32 ramil@stripped +8 -4
    Fix for bug #16546: DATETIME+0 not always coerced the same way
      - test case

# This is a BitKeeper patch.  What follows are the unified diffs for the
# set of deltas contained in the patch.  The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User:	ramil
# Host:	myoffice.izhnet.ru
# Root:	/usr/home/ram/work/4.1.b16546

--- 1.98/sql/item_timefunc.cc	2006-04-13 10:55:41 +05:00
+++ 1.99/sql/item_timefunc.cc	2006-05-02 18:00:32 +05:00
@@ -1372,7 +1372,7 @@ void Item_func_curtime::fix_length_and_d
 {
   TIME ltime;
 
-  decimals=0;
+  decimals= DATETIME_DEC;
   collation.set(&my_charset_bin);
   store_now_in_TIME(&ltime);
   value= TIME_to_ulonglong_time(&ltime);
@@ -1419,7 +1419,7 @@ String *Item_func_now::val_str(String *s
 
 void Item_func_now::fix_length_and_dec()
 {
-  decimals=0;
+  decimals= DATETIME_DEC;
   collation.set(&my_charset_bin);
 
   store_now_in_TIME(&ltime);
@@ -1680,7 +1680,7 @@ void Item_func_from_unixtime::fix_length
 { 
   thd= current_thd;
   collation.set(&my_charset_bin);
-  decimals=0;
+  decimals= DATETIME_DEC;
   max_length=MAX_DATETIME_WIDTH*MY_CHARSET_BIN_MB_MAXLEN;
   maybe_null= 1;
   thd->time_zone_used= 1;

--- 1.56/sql/item_timefunc.h	2006-04-13 10:55:41 +05:00
+++ 1.57/sql/item_timefunc.h	2006-05-02 18:00:32 +05:00
@@ -580,6 +580,7 @@ public:
   { 
     collation.set(&my_charset_bin);
     maybe_null=1;
+    decimals= DATETIME_DEC;
     max_length=MAX_TIME_WIDTH*MY_CHARSET_BIN_MB_MAXLEN;
   }
   enum_field_types field_type() const { return MYSQL_TYPE_TIME; }

--- 1.37/mysql-test/r/func_time.result	2005-06-24 14:04:43 +05:00
+++ 1.38/mysql-test/r/func_time.result	2006-05-02 18:00:32 +05:00
@@ -7,20 +7,20 @@ period_add("9602",-12)	period_diff(19950
 199502	13
 select now()-now(),weekday(curdate())-weekday(now()),unix_timestamp()-unix_timestamp(now());
 now()-now()	weekday(curdate())-weekday(now())	unix_timestamp()-unix_timestamp(now())
-0	0	0
+0.000000	0	0
 select from_unixtime(unix_timestamp("1994-03-02 10:11:12")),from_unixtime(unix_timestamp("1994-03-02 10:11:12"),"%Y-%m-%d %h:%i:%s"),from_unixtime(unix_timestamp("1994-03-02 10:11:12"))+0;
 from_unixtime(unix_timestamp("1994-03-02 10:11:12"))	from_unixtime(unix_timestamp("1994-03-02 10:11:12"),"%Y-%m-%d %h:%i:%s")	from_unixtime(unix_timestamp("1994-03-02 10:11:12"))+0
-1994-03-02 10:11:12	1994-03-02 10:11:12	19940302101112
+1994-03-02 10:11:12	1994-03-02 10:11:12	19940302101112.000000
 select sec_to_time(9001),sec_to_time(9001)+0,time_to_sec("15:12:22"),
 sec_to_time(time_to_sec("0:30:47")/6.21);
 sec_to_time(9001)	sec_to_time(9001)+0	time_to_sec("15:12:22")	sec_to_time(time_to_sec("0:30:47")/6.21)
-02:30:01	23001	54742	00:04:57
+02:30:01	23001.000000	54742	00:04:57
 select sec_to_time(time_to_sec('-838:59:59'));
 sec_to_time(time_to_sec('-838:59:59'))
 -838:59:59
 select now()-curdate()*1000000-curtime();
 now()-curdate()*1000000-curtime()
-0
+0.000000
 select strcmp(current_timestamp(),concat(current_date()," ",current_time()));
 strcmp(current_timestamp(),concat(current_date()," ",current_time()))
 0
@@ -626,3 +626,7 @@ last_day('2005-01-00')
 NULL
 Warnings:
 Warning	1292	Truncated incorrect datetime value: '2005-01-00'
+select now() - now() + 0, curtime() - curtime() + 0, 
+sec_to_time(1) + 0, from_unixtime(1) + 0;
+now() - now() + 0	curtime() - curtime() + 0	sec_to_time(1) + 0	from_unixtime(1) + 0
+0.000000	0.000000	1.000000	19700101030001.000000

--- 1.32/mysql-test/t/func_time.test	2005-07-28 05:21:42 +05:00
+++ 1.33/mysql-test/t/func_time.test	2006-05-02 18:00:32 +05:00
@@ -315,4 +315,12 @@ select last_day('2005-00-00');
 select last_day('2005-00-01');
 select last_day('2005-01-00');
 
+#
+# Bug #16546
+# 
+
+select now() - now() + 0, curtime() - curtime() + 0, 
+       sec_to_time(1) + 0, from_unixtime(1) + 0;
+
+
 # End of 4.1 tests
Thread
bk commit into 4.1 tree (ramil:1.2474) BUG#16546ramil2 May