List:Commits« Previous MessageNext Message »
From:Alexander Barkov Date:November 16 2011 1:46pm
Subject:bzr push into mysql-trunk branch (alexander.barkov:3562 to 3563)
Bug#13392141 WL#946
View as plain text  
 3563 Alexander Barkov	2011-11-16
      WL#946: Bug#13392141 ASSERT FAILURE IN SEC_SINCE_EPOCH

    modified:
      mysql-test/r/type_temporal_fractional.result
      mysql-test/t/type_temporal_fractional.test
      sql/item_func.cc
      sql/item_timefunc.cc
      sql/item_timefunc.h
 3562 Alexander Barkov	2011-11-15
      WL#946: Bug #13391370   ASSERT FAILURE IN TIME_TO_LONGLONG_DATETIME_PACKED
      
      Fixing bug report number incorrectly mentioned in the previous commit.

    modified:
      mysql-test/r/type_temporal_fractional.result
      mysql-test/t/type_temporal_fractional.test
=== modified file 'mysql-test/r/type_temporal_fractional.result'
--- a/mysql-test/r/type_temporal_fractional.result	2011-11-15 13:50:16 +0000
+++ b/mysql-test/r/type_temporal_fractional.result	2011-11-16 13:45:51 +0000
@@ -16524,3 +16524,96 @@ SELECT COUNT(*) FROM t2;
 COUNT(*)
 0
 DROP TABLE t1, t2;
+#
+# Bug#13392141 ASSERT FAILURE IN SEC_SINCE_EPOCH
+#
+SELECT CONVERT_TZ(TIMESTAMP'2021-00-00 00:00:00', '+00:00', '+7:5');
+CONVERT_TZ(TIMESTAMP'2021-00-00 00:00:00', '+00:00', '+7:5')
+NULL
+SELECT CONVERT_TZ(DATE'2021-00-00', '+00:00', '+7:5');
+CONVERT_TZ(DATE'2021-00-00', '+00:00', '+7:5')
+NULL
+SELECT CONVERT_TZ(GREATEST(DATE('2021-00-00'),DATE('2021-00-00')),'+00:00','+7:5');
+CONVERT_TZ(GREATEST(DATE('2021-00-00'),DATE('2021-00-00')),'+00:00','+7:5')
+NULL
+SET timestamp=UNIX_TIMESTAMP('2011-11-16 17:28:30');
+DROP TABLE IF EXISTS t1;
+Warnings:
+Note	1051	Unknown table 'test.t1'
+CREATE TABLE t1 (
+col_timestamp_2_not_null_key timestamp(2) NULL DEFAULT '0000-00-00 00:00:00.00',
+pk time NOT NULL DEFAULT '00:00:00',
+PRIMARY KEY (pk),
+KEY col_timestamp_2_not_null_key (col_timestamp_2_not_null_key));
+INSERT INTO t1 VALUES ('0000-00-00 00:00:00.00','18:49:56');
+INSERT INTO t1 VALUES ('0000-00-00 00:00:00.00','18:49:58');
+INSERT INTO t1 VALUES ('0000-00-00 00:00:00.00','18:50:00');
+INSERT INTO t1 VALUES ('0000-00-00 00:00:00.00','18:50:02');
+INSERT INTO t1 VALUES ('0000-00-00 00:00:00.00','18:50:03');
+INSERT INTO t1 VALUES ('0000-00-00 00:00:00.00','18:50:05');
+INSERT INTO t1 VALUES ('0000-00-00 00:00:00.00','18:50:12');
+INSERT INTO t1 VALUES ('0000-00-00 00:00:00.00','18:50:14');
+INSERT INTO t1 VALUES ('0000-00-00 00:00:00.00','18:50:18');
+INSERT INTO t1 VALUES ('0000-00-00 00:00:00.00','18:50:19');
+INSERT INTO t1 VALUES ('0000-00-00 00:00:00.00','18:50:23');
+INSERT INTO t1 VALUES ('0000-00-00 00:00:00.00','18:50:24');
+INSERT INTO t1 VALUES ('0000-00-00 00:00:00.00','18:50:28');
+INSERT INTO t1 VALUES ('0000-00-00 00:00:00.00','18:50:30');
+INSERT INTO t1 VALUES ('0000-00-00 00:00:00.00','18:50:34');
+INSERT INTO t1 VALUES ('0000-00-00 00:00:00.00','18:50:35');
+INSERT INTO t1 VALUES ('0000-00-00 00:00:00.00','18:50:37');
+INSERT INTO t1 VALUES ('0000-00-00 00:00:00.00','18:50:38');
+INSERT INTO t1 VALUES ('0000-00-00 00:00:00.00','18:50:46');
+INSERT INTO t1 VALUES ('0000-00-00 00:00:00.00','18:50:47');
+INSERT INTO t1 VALUES ('0000-00-00 00:00:00.00','18:50:50');
+INSERT INTO t1 VALUES ('0000-00-00 00:00:00.00','18:50:52');
+INSERT INTO t1 VALUES ('2000-05-24 21:00:00.00','18:50:11');
+INSERT INTO t1 VALUES ('2000-08-09 13:04:19.05','18:50:32');
+INSERT INTO t1 VALUES ('2000-10-05 09:01:10.01','18:50:42');
+INSERT INTO t1 VALUES ('2000-12-08 03:00:13.05','18:50:04');
+INSERT INTO t1 VALUES ('2001-03-02 07:52:23.01','18:50:44');
+INSERT INTO t1 VALUES ('2001-04-24 10:01:32.05','18:50:49');
+INSERT INTO t1 VALUES ('2003-02-18 14:31:23.06','18:50:39');
+INSERT INTO t1 VALUES ('2003-03-07 21:00:00.00','18:50:29');
+INSERT INTO t1 VALUES ('2003-04-16 21:00:00.00','18:50:17');
+INSERT INTO t1 VALUES ('2003-08-10 21:00:00.00','18:50:36');
+INSERT INTO t1 VALUES ('2003-11-24 06:30:37.06','18:49:53');
+INSERT INTO t1 VALUES ('2003-12-01 21:00:00.00','18:50:41');
+INSERT INTO t1 VALUES ('2004-05-16 19:56:24.05','18:50:31');
+INSERT INTO t1 VALUES ('2004-05-27 18:45:05.06','18:50:08');
+INSERT INTO t1 VALUES ('2004-06-05 22:51:19.04','18:50:20');
+INSERT INTO t1 VALUES ('2004-10-16 21:00:00.00','18:49:54');
+INSERT INTO t1 VALUES ('2004-11-02 21:00:00.00','18:50:51');
+INSERT INTO t1 VALUES ('2005-02-23 00:35:02.05','18:50:07');
+INSERT INTO t1 VALUES ('2005-08-15 16:33:48.01','18:50:43');
+INSERT INTO t1 VALUES ('2006-03-14 21:15:50.03','18:50:33');
+INSERT INTO t1 VALUES ('2006-04-24 18:46:21.06','18:50:01');
+INSERT INTO t1 VALUES ('2006-05-14 01:54:29.01','18:50:40');
+INSERT INTO t1 VALUES ('2006-08-23 22:33:51.02','18:50:06');
+INSERT INTO t1 VALUES ('2006-11-15 02:06:29.02','18:49:59');
+INSERT INTO t1 VALUES ('2006-11-28 11:32:09.03','18:50:15');
+INSERT INTO t1 VALUES ('2007-01-19 18:45:01.00','18:50:25');
+INSERT INTO t1 VALUES ('2007-01-23 18:04:25.01','18:50:27');
+INSERT INTO t1 VALUES ('2007-06-20 18:42:45.01','18:50:48');
+INSERT INTO t1 VALUES ('2007-08-27 21:00:00.00','18:50:22');
+INSERT INTO t1 VALUES ('2007-10-11 09:54:15.02','18:50:45');
+INSERT INTO t1 VALUES ('2008-01-24 18:55:00.04','18:50:10');
+INSERT INTO t1 VALUES ('2008-03-03 16:06:21.03','18:50:16');
+INSERT INTO t1 VALUES ('2008-03-23 21:00:00.00','18:50:26');
+INSERT INTO t1 VALUES ('2008-05-28 10:12:34.06','18:49:57');
+INSERT INTO t1 VALUES ('2009-06-09 21:31:23.04','18:50:21');
+INSERT INTO t1 VALUES ('2009-06-14 09:15:36.06','18:50:09');
+INSERT INTO t1 VALUES ('2009-06-30 23:31:57.01','18:49:55');
+INSERT INTO t1 VALUES ('2009-12-25 17:54:17.00','18:50:13');
+INSERT INTO t1 VALUES ('2005-12-15 18:49:06.05','00:00:00');
+SELECT col_timestamp_2_not_null_key
+FROM t1
+WHERE CONVERT_TZ(GREATEST('2005-11-05 18:16:50.055749', STR_TO_DATE(CURRENT_TIME, '%Y')),
+'+00:00', CONCAT('+', CONCAT_WS(':', 7, 5)));
+col_timestamp_2_not_null_key
+Warnings:
+Warning	1292	Truncated incorrect date value: '17:28:30'
+Warning	1292	Truncated incorrect date value: '17:28:30'
+Warning	1292	Truncated incorrect date value: '17:28:30'
+DROP TABLE t1;
+SET timestamp=DEFAULT;

=== modified file 'mysql-test/t/type_temporal_fractional.test'
--- a/mysql-test/t/type_temporal_fractional.test	2011-11-15 13:50:16 +0000
+++ b/mysql-test/t/type_temporal_fractional.test	2011-11-16 13:45:51 +0000
@@ -7114,6 +7114,91 @@ DELETE FROM t2 WHERE c1 IN (SELECT CAST(
 SELECT COUNT(*) FROM t2;
 DROP TABLE t1, t2;
 
+--echo #
+--echo # Bug#13392141 ASSERT FAILURE IN SEC_SINCE_EPOCH
+--echo #
+SELECT CONVERT_TZ(TIMESTAMP'2021-00-00 00:00:00', '+00:00', '+7:5');
+SELECT CONVERT_TZ(DATE'2021-00-00', '+00:00', '+7:5');
+SELECT CONVERT_TZ(GREATEST(DATE('2021-00-00'),DATE('2021-00-00')),'+00:00','+7:5');
+
+#
+# Bug 13392141 - ASSERT FAILURE IN SEC_SINCE_EPOCH
+#
+SET timestamp=UNIX_TIMESTAMP('2011-11-16 17:28:30');
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (
+  col_timestamp_2_not_null_key timestamp(2) NULL DEFAULT '0000-00-00 00:00:00.00',
+  pk time NOT NULL DEFAULT '00:00:00',
+  PRIMARY KEY (pk),
+  KEY col_timestamp_2_not_null_key (col_timestamp_2_not_null_key));
+INSERT INTO t1 VALUES ('0000-00-00 00:00:00.00','18:49:56');
+INSERT INTO t1 VALUES ('0000-00-00 00:00:00.00','18:49:58');
+INSERT INTO t1 VALUES ('0000-00-00 00:00:00.00','18:50:00');
+INSERT INTO t1 VALUES ('0000-00-00 00:00:00.00','18:50:02');
+INSERT INTO t1 VALUES ('0000-00-00 00:00:00.00','18:50:03');
+INSERT INTO t1 VALUES ('0000-00-00 00:00:00.00','18:50:05');
+INSERT INTO t1 VALUES ('0000-00-00 00:00:00.00','18:50:12');
+INSERT INTO t1 VALUES ('0000-00-00 00:00:00.00','18:50:14');
+INSERT INTO t1 VALUES ('0000-00-00 00:00:00.00','18:50:18');
+INSERT INTO t1 VALUES ('0000-00-00 00:00:00.00','18:50:19');
+INSERT INTO t1 VALUES ('0000-00-00 00:00:00.00','18:50:23');
+INSERT INTO t1 VALUES ('0000-00-00 00:00:00.00','18:50:24');
+INSERT INTO t1 VALUES ('0000-00-00 00:00:00.00','18:50:28');
+INSERT INTO t1 VALUES ('0000-00-00 00:00:00.00','18:50:30');
+INSERT INTO t1 VALUES ('0000-00-00 00:00:00.00','18:50:34');
+INSERT INTO t1 VALUES ('0000-00-00 00:00:00.00','18:50:35');
+INSERT INTO t1 VALUES ('0000-00-00 00:00:00.00','18:50:37');
+INSERT INTO t1 VALUES ('0000-00-00 00:00:00.00','18:50:38');
+INSERT INTO t1 VALUES ('0000-00-00 00:00:00.00','18:50:46');
+INSERT INTO t1 VALUES ('0000-00-00 00:00:00.00','18:50:47');
+INSERT INTO t1 VALUES ('0000-00-00 00:00:00.00','18:50:50');
+INSERT INTO t1 VALUES ('0000-00-00 00:00:00.00','18:50:52');
+INSERT INTO t1 VALUES ('2000-05-24 21:00:00.00','18:50:11');
+INSERT INTO t1 VALUES ('2000-08-09 13:04:19.05','18:50:32');
+INSERT INTO t1 VALUES ('2000-10-05 09:01:10.01','18:50:42');
+INSERT INTO t1 VALUES ('2000-12-08 03:00:13.05','18:50:04');
+INSERT INTO t1 VALUES ('2001-03-02 07:52:23.01','18:50:44');
+INSERT INTO t1 VALUES ('2001-04-24 10:01:32.05','18:50:49');
+INSERT INTO t1 VALUES ('2003-02-18 14:31:23.06','18:50:39');
+INSERT INTO t1 VALUES ('2003-03-07 21:00:00.00','18:50:29');
+INSERT INTO t1 VALUES ('2003-04-16 21:00:00.00','18:50:17');
+INSERT INTO t1 VALUES ('2003-08-10 21:00:00.00','18:50:36');
+INSERT INTO t1 VALUES ('2003-11-24 06:30:37.06','18:49:53');
+INSERT INTO t1 VALUES ('2003-12-01 21:00:00.00','18:50:41');
+INSERT INTO t1 VALUES ('2004-05-16 19:56:24.05','18:50:31');
+INSERT INTO t1 VALUES ('2004-05-27 18:45:05.06','18:50:08');
+INSERT INTO t1 VALUES ('2004-06-05 22:51:19.04','18:50:20');
+INSERT INTO t1 VALUES ('2004-10-16 21:00:00.00','18:49:54');
+INSERT INTO t1 VALUES ('2004-11-02 21:00:00.00','18:50:51');
+INSERT INTO t1 VALUES ('2005-02-23 00:35:02.05','18:50:07');
+INSERT INTO t1 VALUES ('2005-08-15 16:33:48.01','18:50:43');
+INSERT INTO t1 VALUES ('2006-03-14 21:15:50.03','18:50:33');
+INSERT INTO t1 VALUES ('2006-04-24 18:46:21.06','18:50:01');
+INSERT INTO t1 VALUES ('2006-05-14 01:54:29.01','18:50:40');
+INSERT INTO t1 VALUES ('2006-08-23 22:33:51.02','18:50:06');
+INSERT INTO t1 VALUES ('2006-11-15 02:06:29.02','18:49:59');
+INSERT INTO t1 VALUES ('2006-11-28 11:32:09.03','18:50:15');
+INSERT INTO t1 VALUES ('2007-01-19 18:45:01.00','18:50:25');
+INSERT INTO t1 VALUES ('2007-01-23 18:04:25.01','18:50:27');
+INSERT INTO t1 VALUES ('2007-06-20 18:42:45.01','18:50:48');
+INSERT INTO t1 VALUES ('2007-08-27 21:00:00.00','18:50:22');
+INSERT INTO t1 VALUES ('2007-10-11 09:54:15.02','18:50:45');
+INSERT INTO t1 VALUES ('2008-01-24 18:55:00.04','18:50:10');
+INSERT INTO t1 VALUES ('2008-03-03 16:06:21.03','18:50:16');
+INSERT INTO t1 VALUES ('2008-03-23 21:00:00.00','18:50:26');
+INSERT INTO t1 VALUES ('2008-05-28 10:12:34.06','18:49:57');
+INSERT INTO t1 VALUES ('2009-06-09 21:31:23.04','18:50:21');
+INSERT INTO t1 VALUES ('2009-06-14 09:15:36.06','18:50:09');
+INSERT INTO t1 VALUES ('2009-06-30 23:31:57.01','18:49:55');
+INSERT INTO t1 VALUES ('2009-12-25 17:54:17.00','18:50:13');
+INSERT INTO t1 VALUES ('2005-12-15 18:49:06.05','00:00:00');
+SELECT col_timestamp_2_not_null_key
+FROM t1
+WHERE CONVERT_TZ(GREATEST('2005-11-05 18:16:50.055749', STR_TO_DATE(CURRENT_TIME, '%Y')),
+              '+00:00', CONCAT('+', CONCAT_WS(':', 7, 5)));
+DROP TABLE t1;
+SET timestamp=DEFAULT;
+
 ## TS-TODO: SELECT CAST('00:00:00' AS DATETIME) -> should it use curdate?
 
 ## TS-TODO: reuse count_datetime_length()/count_string_result_length()

=== modified file 'sql/item_func.cc'
--- a/sql/item_func.cc	2011-11-14 19:55:51 +0000
+++ b/sql/item_func.cc	2011-11-16 13:45:51 +0000
@@ -2932,7 +2932,8 @@ bool Item_func_min_max::get_date(MYSQL_T
     if (null_value)
       return true;
     TIME_from_longlong_packed(ltime, datetime_item->field_type(), result);
-    return false;
+    int warnings;
+    return check_date(ltime, non_zero_date(ltime), fuzzydate, &warnings);
   }
 
   switch (field_type())

=== modified file 'sql/item_timefunc.cc'
--- a/sql/item_timefunc.cc	2011-11-15 06:52:11 +0000
+++ b/sql/item_timefunc.cc	2011-11-16 13:45:51 +0000
@@ -1793,6 +1793,14 @@ const char *MYSQL_TIME_cache::cptr()
 }
 
 
+bool MYSQL_TIME_cache::get_date(MYSQL_TIME *ltime, uint fuzzydate) const
+{
+  int warnings;
+  get_TIME(ltime);
+  return check_date(ltime, non_zero_date(ltime), fuzzydate, &warnings);
+}
+
+
 String *MYSQL_TIME_cache::val_str(String *str)
 {
   cache_string();

=== modified file 'sql/item_timefunc.h'
--- a/sql/item_timefunc.h	2011-11-10 14:58:23 +0000
+++ b/sql/item_timefunc.h	2011-11-16 13:45:51 +0000
@@ -762,6 +762,14 @@ class MYSQL_TIME_cache
     reset_string();
     dec= 0;
   }
+  /**
+    Store MYSQL_TIME representation into the given MYSQL_TIME variable.
+  */
+  void get_TIME(MYSQL_TIME *ltime) const
+  {
+    DBUG_ASSERT(time.time_type != MYSQL_TIMESTAMP_NONE);
+    *ltime= time;
+  }
 public:
 
   MYSQL_TIME_cache()
@@ -821,12 +829,17 @@ public:
     return time_packed;
   }
   /**
-    Store MYSQL_TIME representation into the given MYSQL_TIME variable.
+    Store MYSQL_TIME representation into the given date/datetime variable
+    checking date flags.
   */
-  void get_TIME(MYSQL_TIME *ltime) const
+  bool get_date(MYSQL_TIME *ltime, uint fuzzyflags) const;
+  /**
+    Store MYSQL_TIME representation into the given time variable.
+  */
+  bool get_time(MYSQL_TIME *ltime) const
   {
-    DBUG_ASSERT(time.time_type != MYSQL_TIMESTAMP_NONE);
-    *ltime= time;
+    get_TIME(ltime);
+    return false;
   }
   /**
     Return pointer to MYSQL_TIME representation.
@@ -874,8 +887,7 @@ public:
   bool get_date(MYSQL_TIME *ltime, uint fuzzy_date)
   {
     DBUG_ASSERT(fixed);
-    cached_time.get_TIME(ltime);
-    return false;
+    return cached_time.get_date(ltime, fuzzy_date);
   }
   String *val_str(String *str)
   {
@@ -932,8 +944,7 @@ public:
   bool get_time(MYSQL_TIME *ltime)
   {
     DBUG_ASSERT(fixed);
-    cached_time.get_TIME(ltime);
-    return false;
+    return cached_time.get_time(ltime);
   }
   String *val_str(String *str)
   {
@@ -990,8 +1001,7 @@ public:
   bool get_date(MYSQL_TIME *ltime, uint fuzzy_date)
   {
     DBUG_ASSERT(fixed);
-    cached_time.get_TIME(ltime);
-    return false;
+    return cached_time.get_date(ltime, fuzzy_date);
   }
   String *val_str(String *str)
   {
@@ -1042,8 +1052,7 @@ public:
   bool get_time(MYSQL_TIME *ltime)
   {
     DBUG_ASSERT(fixed == 1);
-    cached_time.get_TIME(ltime);
-    return false;
+    return cached_time.get_time(ltime);
   }
   String *val_str(String *str)
   {
@@ -1091,8 +1100,7 @@ public:
   bool get_date(MYSQL_TIME *res, uint fuzzy_date)
   {
     DBUG_ASSERT(fixed == 1);
-    cached_time.get_TIME(res);
-    return false;
+    return cached_time.get_time(res);
   }
   String *val_str(String *str)
   {
@@ -1145,8 +1153,7 @@ public:
   bool get_date(MYSQL_TIME *res, uint fuzzy_date)
   {
     DBUG_ASSERT(fixed == 1);
-    cached_time.get_TIME(res);
-    return false;
+    return cached_time.get_time(res);
   }
   String *val_str(String *str)
   {

No bundle (reason: useless for push emails).
Thread
bzr push into mysql-trunk branch (alexander.barkov:3562 to 3563)Bug#13392141 WL#946Alexander Barkov18 Nov