List:Commits« Previous MessageNext Message »
From:Alexander Barkov Date:November 15 2011 1:07pm
Subject:bzr push into mysql-trunk branch (alexander.barkov:3560 to 3561)
Bug#13386657 WL#946
View as plain text  
 3561 Alexander Barkov	2011-11-15
      WL#946: BUG#13386657 ASSERT FAILURE IN ITEM::GET_DATE_FROM_NON_TEMPORAL, PART2

    modified:
      mysql-test/r/type_temporal_fractional.result
      mysql-test/t/type_temporal_fractional.test
      sql/item.cc
 3560 Alexander Barkov	2011-11-15
      WL#946:
      Bug#13384069 - EMBEDED UPDATE WITH CAST AND DATETIME WITH FSP DOES NOT WORK
      Bug#13383838 - DELETE DOESN'T EMPTY RECORDS WHEN CAST WITH DATETIME TYPE IN EMBEDED SELECT

    modified:
      mysql-test/r/type_temporal_fractional.result
      mysql-test/t/type_temporal_fractional.test
      sql/item.cc
      sql/item_timefunc.cc
=== modified file 'mysql-test/r/type_temporal_fractional.result'
--- a/mysql-test/r/type_temporal_fractional.result	2011-11-15 06:52:11 +0000
+++ b/mysql-test/r/type_temporal_fractional.result	2011-11-15 13:06:17 +0000
@@ -16378,6 +16378,56 @@ ROUND(COALESCE(a,a))
 20010101102031
 DROP TABLE t1;
 #
+# BUG#13386657 ASSERT FAILURE IN ITEM::GET_DATE_FROM_NON_TEMPORAL, PART2
+#
+SET timestamp=UNIX_TIMESTAMP('2011-11-15 16:25:30');
+CREATE TABLE t1 (
+col_time_2_not_null time(2) NOT NULL,  
+col_timestamp_1_not_null timestamp(1) NULL DEFAULT '0000-00-00 00:00:00.0',  
+col_datetime_1 datetime(1) DEFAULT NULL,
+col_timestamp_4_not_null timestamp(4) NULL DEFAULT '0000-00-00 00:00:00.0000',  
+col_timestamp_6_not_null_key timestamp(6) NULL DEFAULT '0000-00-00 00:00:00.000000',
+col_date date DEFAULT NULL,
+KEY col_timestamp_6_not_null_key (col_timestamp_6_not_null_key));
+DELETE FROM t1;
+INSERT INTO t1 VALUES ('00:20:09.00','2008-02-09 00:19:47.1','0000-00-00 00:00:00.0','2009-03-13 00:56:44.0401','2008-10-17 09:43:02.051040','2000-11-13');
+INSERT INTO t1 VALUES ('00:20:04.00','0000-00-00 00:00:00.0','0000-00-00 00:00:00.0','0000-00-00 00:00:00.0000','0000-00-00 00:00:00.000000','2006-11-14');
+INSERT INTO t1 VALUES ('15:54:14.06','2003-04-19 04:55:47.0',NULL,'0000-00-00 00:00:00.0000','2009-12-27 02:49:14.005722','0000-00-00');
+INSERT INTO t1 VALUES ('04:58:16.02','2004-02-17 21:00:00.0',NULL,'0000-00-00 00:00:00.0000','2001-10-07 11:02:50.054375','2000-04-10');
+INSERT INTO t1 VALUES ('10:34:28.04','2006-10-16 21:00:00.0',NULL,'0000-00-00 00:00:00.0000','2008-05-17 05:14:50.028683','0000-00-00');
+INSERT INTO t1 VALUES ('14:17:38.04','2001-06-24 04:33:25.0','2008-09-05 21:25:39.0','0000-00-00 00:00:00.0000','0000-00-00 00:00:00.000000',NULL);
+INSERT INTO t1 VALUES ('00:20:06.00','2005-06-26 22:52:46.0','0000-00-00 00:00:00.0','2000-09-11 02:51:17.0211','0000-00-00 00:00:00.000000','2006-10-10');
+INSERT INTO t1 VALUES ('00:09:41.03','0000-00-00 00:00:00.0','2008-02-16 19:59:19.0','2000-10-21 21:00:00.0000','2006-11-14 10:22:27.009969','0000-00-00');
+INSERT INTO t1 VALUES ('16:57:08.01','2009-05-13 21:03:39.0','2004-01-12 11:46:42.0','2000-02-28 10:51:01.0152','2001-05-10 14:21:38.022082',NULL);
+INSERT INTO t1 VALUES ('19:02:15.03','0000-00-00 00:00:00.0','2009-07-16 20:15:38.1','0000-00-00 00:00:00.0000','0000-00-00 00:00:00.000000',NULL);
+SELECT
+SUBTIME('2002-04-08 06:05:42.056589', '01:26:40.063385') AS c1
+FROM
+t1
+WHERE
+col_timestamp_6_not_null_key IN (
+LEAST(col_datetime_1, MAKETIME(24,8,0),
+ADDTIME(NOW(),'06:07:21.061946'), col_time_2_not_null),
+DATE ('2005-11-03'),
+CURTIME(),
+COALESCE(col_timestamp_4_not_null, TIMESTAMP('2003-09-10')))
+ORDER BY
+col_date,
+col_timestamp_1_not_null;
+c1
+2002-04-08 04:39:01.993204
+2002-04-08 04:39:01.993204
+2002-04-08 04:39:01.993204
+2002-04-08 04:39:01.993204
+DROP TABLE t1;
+CREATE TABLE t1 (a datetime(1));
+INSERT INTO t1 VALUES ('2006-11-14 10:22:27.009969');
+SELECT * FROM t1
+WHERE timestamp'2006-11-14 10:22:27.009969' IN (LEAST(a, MAKETIME(24,8,0)));
+a
+DROP TABLE t1;
+SET timestamp=DEFAULT;
+#
 # Bug#13384069 - EMBEDED UPDATE WITH CAST AND DATETIME WITH FSP DOES NOT WORK
 #
 CREATE TABLE t1 (

=== modified file 'mysql-test/t/type_temporal_fractional.test'
--- a/mysql-test/t/type_temporal_fractional.test	2011-11-15 06:52:11 +0000
+++ b/mysql-test/t/type_temporal_fractional.test	2011-11-15 13:06:17 +0000
@@ -7008,6 +7008,51 @@ SELECT ROUND(COALESCE(a,a)) FROM t1;
 DROP TABLE t1;
 
 --echo #
+--echo # BUG#13386657 ASSERT FAILURE IN ITEM::GET_DATE_FROM_NON_TEMPORAL, PART2
+--echo #
+SET timestamp=UNIX_TIMESTAMP('2011-11-15 16:25:30');
+CREATE TABLE t1 (
+  col_time_2_not_null time(2) NOT NULL,  
+  col_timestamp_1_not_null timestamp(1) NULL DEFAULT '0000-00-00 00:00:00.0',  
+  col_datetime_1 datetime(1) DEFAULT NULL,
+  col_timestamp_4_not_null timestamp(4) NULL DEFAULT '0000-00-00 00:00:00.0000',  
+  col_timestamp_6_not_null_key timestamp(6) NULL DEFAULT '0000-00-00 00:00:00.000000',
+  col_date date DEFAULT NULL,
+  KEY col_timestamp_6_not_null_key (col_timestamp_6_not_null_key));
+DELETE FROM t1;
+INSERT INTO t1 VALUES ('00:20:09.00','2008-02-09 00:19:47.1','0000-00-00 00:00:00.0','2009-03-13 00:56:44.0401','2008-10-17 09:43:02.051040','2000-11-13');
+INSERT INTO t1 VALUES ('00:20:04.00','0000-00-00 00:00:00.0','0000-00-00 00:00:00.0','0000-00-00 00:00:00.0000','0000-00-00 00:00:00.000000','2006-11-14');
+INSERT INTO t1 VALUES ('15:54:14.06','2003-04-19 04:55:47.0',NULL,'0000-00-00 00:00:00.0000','2009-12-27 02:49:14.005722','0000-00-00');
+INSERT INTO t1 VALUES ('04:58:16.02','2004-02-17 21:00:00.0',NULL,'0000-00-00 00:00:00.0000','2001-10-07 11:02:50.054375','2000-04-10');
+INSERT INTO t1 VALUES ('10:34:28.04','2006-10-16 21:00:00.0',NULL,'0000-00-00 00:00:00.0000','2008-05-17 05:14:50.028683','0000-00-00');
+INSERT INTO t1 VALUES ('14:17:38.04','2001-06-24 04:33:25.0','2008-09-05 21:25:39.0','0000-00-00 00:00:00.0000','0000-00-00 00:00:00.000000',NULL);
+INSERT INTO t1 VALUES ('00:20:06.00','2005-06-26 22:52:46.0','0000-00-00 00:00:00.0','2000-09-11 02:51:17.0211','0000-00-00 00:00:00.000000','2006-10-10');
+INSERT INTO t1 VALUES ('00:09:41.03','0000-00-00 00:00:00.0','2008-02-16 19:59:19.0','2000-10-21 21:00:00.0000','2006-11-14 10:22:27.009969','0000-00-00');
+INSERT INTO t1 VALUES ('16:57:08.01','2009-05-13 21:03:39.0','2004-01-12 11:46:42.0','2000-02-28 10:51:01.0152','2001-05-10 14:21:38.022082',NULL);
+INSERT INTO t1 VALUES ('19:02:15.03','0000-00-00 00:00:00.0','2009-07-16 20:15:38.1','0000-00-00 00:00:00.0000','0000-00-00 00:00:00.000000',NULL);
+SELECT
+    SUBTIME('2002-04-08 06:05:42.056589', '01:26:40.063385') AS c1
+FROM
+    t1
+WHERE
+  col_timestamp_6_not_null_key IN (
+        LEAST(col_datetime_1, MAKETIME(24,8,0),
+              ADDTIME(NOW(),'06:07:21.061946'), col_time_2_not_null),
+        DATE ('2005-11-03'),
+        CURTIME(),
+        COALESCE(col_timestamp_4_not_null, TIMESTAMP('2003-09-10')))
+ORDER BY
+    col_date,
+    col_timestamp_1_not_null;
+DROP TABLE t1;
+CREATE TABLE t1 (a datetime(1));
+INSERT INTO t1 VALUES ('2006-11-14 10:22:27.009969');
+SELECT * FROM t1
+WHERE timestamp'2006-11-14 10:22:27.009969' IN (LEAST(a, MAKETIME(24,8,0)));
+DROP TABLE t1;
+SET timestamp=DEFAULT;
+
+--echo #
 --echo # Bug#13384069 - EMBEDED UPDATE WITH CAST AND DATETIME WITH FSP DOES NOT WORK
 --echo #
 CREATE TABLE t1 (

=== modified file 'sql/item.cc'
--- a/sql/item.cc	2011-11-15 06:52:11 +0000
+++ b/sql/item.cc	2011-11-15 13:06:17 +0000
@@ -8494,6 +8494,13 @@ longlong Item_cache_datetime::val_time_t
   DBUG_ASSERT(fixed == 1);
   if ((!value_cached && !cache_value_int()) || null_value)
     return 0;
+  if (is_temporal_with_date())
+  {
+    /* Convert packed date to packed time */
+    MYSQL_TIME ltime;
+    return get_time_from_date(&ltime) ? 0 :
+           TIME_to_longlong_packed(&ltime, field_type());
+  }
   return int_value;
 }
 
@@ -8502,6 +8509,14 @@ longlong Item_cache_datetime::val_date_t
   DBUG_ASSERT(fixed == 1);
   if ((!value_cached && !cache_value_int()) || null_value)
     return 0;
+  if (cached_field_type == MYSQL_TYPE_TIME)
+  {
+    /* Convert packed time to packed date */
+    MYSQL_TIME ltime;
+    return get_date_from_time(&ltime) ? 0 :
+           TIME_to_longlong_datetime_packed(&ltime);
+    
+  }
   return int_value;
 }
 

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