List:Commits« Previous MessageNext Message »
From:Alexander Barkov Date:November 14 2011 7:58pm
Subject:bzr push into mysql-trunk branch (alexander.barkov:3558 to 3559)
Bug#13386657 WL#946
View as plain text  
 3559 Alexander Barkov	2011-11-14
      WL#946: Bug#13386657 ASSERT FAILURE IN ITEM::GET_DATE_FROM_NON_TEMPORAL

    modified:
      mysql-test/r/type_temporal_fractional.result
      mysql-test/t/type_temporal_fractional.test
      sql/item_func.cc
 3558 Alexander Barkov	2011-11-14
      WL#946 testing valgrind failures in "mtr --valgrind --do-test=subquery"

    modified:
      sql/item_sum.cc
=== modified file 'mysql-test/r/type_temporal_fractional.result'
--- a/mysql-test/r/type_temporal_fractional.result	2011-11-14 09:58:55 +0000
+++ b/mysql-test/r/type_temporal_fractional.result	2011-11-14 19:55:51 +0000
@@ -16338,3 +16338,42 @@ ADDTIME(GREATEST(col_date_not_null_key, 
 21:11:59.039348
 21:11:59.039348
 DROP TABLE t1;
+#
+# BUG#13386657 ASSERT FAILURE IN ITEM::GET_DATE_FROM_NON_TEMPORAL
+#
+CREATE TABLE t1 (
+col_time_5_not_null_key time(5) NOT NULL,
+col_datetime_4 datetime(4) DEFAULT NULL,
+col_timestamp_1_not_null_key timestamp(1) NULL DEFAULT '0000-00-00 00:00:00.0',
+col_datetime_3_not_null_key datetime(3) NOT NULL,
+KEY col_time_5_not_null_key (col_time_5_not_null_key),
+KEY col_timestamp_1_not_null_key (col_timestamp_1_not_null_key),
+KEY col_datetime_3_not_null_key (col_datetime_3_not_null_key));
+INSERT INTO t1 VALUES ('15:01:38.00004','0000-00-00 00:00:00.0000','2005-06-08 16:51:23.0','0000-00-00 00:00:00.000');
+SELECT col_datetime_4 
+FROM t1
+WHERE col_datetime_3_not_null_key IN
+(COALESCE (col_timestamp_1_not_null_key), col_time_5_not_null_key);
+col_datetime_4
+DROP TABLE t1;
+CREATE TABLE t1 (a TIMESTAMP(3));
+INSERT INTO t1 VALUES ('2001-01-01 10:20:30.999');
+SELECT CAST(COALESCE(a,a) AS CHAR) FROM t1;
+CAST(COALESCE(a,a) AS CHAR)
+2001-01-01 10:20:30.999
+SELECT CAST(COALESCE(a,a) AS SIGNED) FROM t1;
+CAST(COALESCE(a,a) AS SIGNED)
+20010101102031
+SELECT CAST(COALESCE(a,a) AS DECIMAL(25,3)) FROM t1;
+CAST(COALESCE(a,a) AS DECIMAL(25,3))
+20010101102030.999
+SELECT CAST(COALESCE(a,a) AS DATETIME(6)) FROM t1;
+CAST(COALESCE(a,a) AS DATETIME(6))
+2001-01-01 10:20:30.999000
+SELECT CAST(COALESCE(a,a) AS TIME(6)) FROM t1;
+CAST(COALESCE(a,a) AS TIME(6))
+10:20:30.999000
+SELECT ROUND(COALESCE(a,a)) FROM t1;
+ROUND(COALESCE(a,a))
+20010101102031
+DROP TABLE t1;

=== modified file 'mysql-test/t/type_temporal_fractional.test'
--- a/mysql-test/t/type_temporal_fractional.test	2011-11-14 09:58:55 +0000
+++ b/mysql-test/t/type_temporal_fractional.test	2011-11-14 19:55:51 +0000
@@ -6980,7 +6980,32 @@ SELECT ADDTIME(GREATEST(col_date_not_nul
 FROM t1; 
 DROP TABLE t1;
 
-
+--echo #
+--echo # BUG#13386657 ASSERT FAILURE IN ITEM::GET_DATE_FROM_NON_TEMPORAL
+--echo #
+CREATE TABLE t1 (
+  col_time_5_not_null_key time(5) NOT NULL,
+  col_datetime_4 datetime(4) DEFAULT NULL,
+  col_timestamp_1_not_null_key timestamp(1) NULL DEFAULT '0000-00-00 00:00:00.0',
+  col_datetime_3_not_null_key datetime(3) NOT NULL,
+  KEY col_time_5_not_null_key (col_time_5_not_null_key),
+  KEY col_timestamp_1_not_null_key (col_timestamp_1_not_null_key),
+  KEY col_datetime_3_not_null_key (col_datetime_3_not_null_key));
+INSERT INTO t1 VALUES ('15:01:38.00004','0000-00-00 00:00:00.0000','2005-06-08 16:51:23.0','0000-00-00 00:00:00.000');
+SELECT col_datetime_4 
+FROM t1
+WHERE col_datetime_3_not_null_key IN
+(COALESCE (col_timestamp_1_not_null_key), col_time_5_not_null_key);
+DROP TABLE t1;
+CREATE TABLE t1 (a TIMESTAMP(3));
+INSERT INTO t1 VALUES ('2001-01-01 10:20:30.999');
+SELECT CAST(COALESCE(a,a) AS CHAR) FROM t1;
+SELECT CAST(COALESCE(a,a) AS SIGNED) FROM t1;
+SELECT CAST(COALESCE(a,a) AS DECIMAL(25,3)) FROM t1;
+SELECT CAST(COALESCE(a,a) AS DATETIME(6)) FROM t1;
+SELECT CAST(COALESCE(a,a) AS TIME(6)) FROM t1;
+SELECT ROUND(COALESCE(a,a)) FROM t1;
+DROP TABLE t1;
 
 ## TS-TODO: SELECT CAST('00:00:00' AS DATETIME) -> should it use curdate?
 

=== modified file 'sql/item_func.cc'
--- a/sql/item_func.cc	2011-11-14 09:58:55 +0000
+++ b/sql/item_func.cc	2011-11-14 19:55:51 +0000
@@ -900,6 +900,7 @@ String *Item_func_numhybrid::val_str(Str
   case STRING_RESULT:
     switch (field_type()) {
     case MYSQL_TYPE_DATETIME:
+    case MYSQL_TYPE_TIMESTAMP:
       return val_string_from_datetime(str);
     case MYSQL_TYPE_DATE:
       return val_string_from_date(str);
@@ -943,6 +944,7 @@ double Item_func_numhybrid::val_real()
     case MYSQL_TYPE_TIME:
     case MYSQL_TYPE_DATE:
     case MYSQL_TYPE_DATETIME:
+    case MYSQL_TYPE_TIMESTAMP:
       return val_real_from_decimal();
     default:
       break;
@@ -984,6 +986,7 @@ longlong Item_func_numhybrid::val_int()
     case MYSQL_TYPE_DATE:
       return val_int_from_date();
     case MYSQL_TYPE_DATETIME:
+    case MYSQL_TYPE_TIMESTAMP:
       return val_int_from_datetime();
     case MYSQL_TYPE_TIME:
       return val_int_from_time();
@@ -1032,6 +1035,7 @@ my_decimal *Item_func_numhybrid::val_dec
     {
     case MYSQL_TYPE_DATE:
     case MYSQL_TYPE_DATETIME:
+    case MYSQL_TYPE_TIMESTAMP:
       return val_decimal_from_date(decimal_value);
     case MYSQL_TYPE_TIME:
       return val_decimal_from_time(decimal_value);
@@ -1061,6 +1065,7 @@ bool Item_func_numhybrid::get_date(MYSQL
   {
   case MYSQL_TYPE_DATE:
   case MYSQL_TYPE_DATETIME:
+  case MYSQL_TYPE_TIMESTAMP:
     return date_op(ltime, fuzzydate);
   case MYSQL_TYPE_TIME:
     return get_date_from_time(ltime);
@@ -1080,6 +1085,7 @@ bool Item_func_numhybrid::get_time(MYSQL
   case MYSQL_TYPE_DATE:
     return get_time_from_date(ltime);
   case MYSQL_TYPE_DATETIME:
+  case MYSQL_TYPE_TIMESTAMP:
     return get_time_from_datetime(ltime);
   default:
     return Item::get_time_from_non_temporal(ltime);

No bundle (reason: useless for push emails).
Thread
bzr push into mysql-trunk branch (alexander.barkov:3558 to 3559)Bug#13386657 WL#946Alexander Barkov15 Nov