List:Commits« Previous MessageNext Message »
From:Alexander Barkov Date:November 21 2011 11:06am
Subject:bzr push into mysql-trunk branch (alexander.barkov:3601 to 3602) WL#946
View as plain text  
 3602 Alexander Barkov	2011-11-21
      WL#946: Better gcove coverage.

    modified:
      mysql-test/r/type_temporal_fractional.result
      mysql-test/t/type_temporal_fractional.test
      sql/item_timefunc.cc
      sql/item_timefunc.h
 3601 Alexander Barkov	2011-11-19
      WL#946: Bug#13394031 VALGRIND: CONDITIONAL JUMP/MOVE DEPENDS ON UNINITIALISED IN FIELD::IS_REAL_NULL

    modified:
      mysql-test/r/type_temporal_fractional.result
      mysql-test/t/type_temporal_fractional.test
      sql/item.cc
      sql/item.h
      sql/item_cmpfunc.h
      sql/opt_range.cc
=== modified file 'mysql-test/r/type_temporal_fractional.result'
--- a/mysql-test/r/type_temporal_fractional.result	2011-11-19 19:47:50 +0000
+++ b/mysql-test/r/type_temporal_fractional.result	2011-11-21 11:05:05 +0000
@@ -2503,6 +2503,15 @@ ERROR 42000: Too big precision 7 specifi
 CREATE TABLE t1 (a TIME(31));
 ERROR 42000: Too big precision 31 specified for column 'a'. Maximum is 6.
 #
+# Testing bad FSPs with TIME functions
+#
+SELECT CURTIME(-1);
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '-1)' at line 1
+SELECT CURTIME(7);
+ERROR 42000: Too big precision 7 specified for column 'curtime'. Maximum is 6.
+SELECT CURTIME(31);
+ERROR 42000: Too big precision 31 specified for column 'curtime'. Maximum is 6.
+#
 # Testing INSERT, ORDER, KEY, BETWEEN, comparison
 #
 CREATE TABLE t1 (a TIME(6) NOT NULL);
@@ -5465,6 +5474,24 @@ DROP TABLE t1;
 #
 # Testing hybrid functions in TIME context
 #
+SELECT DATE_ADD(TIME'00:00:00.0', INTERVAL 10.1 SECOND);
+DATE_ADD(TIME'00:00:00.0', INTERVAL 10.1 SECOND)
+00:00:10.1
+SELECT DATE_ADD(TIME'00:00:00.0', INTERVAL 10000000.1 SECOND);
+DATE_ADD(TIME'00:00:00.0', INTERVAL 10000000.1 SECOND)
+NULL
+Warnings:
+Warning	1441	Datetime function: time field overflow
+SELECT DATE_ADD(TIME'00:00:00.0', INTERVAL 100000000000000000.1 SECOND);
+DATE_ADD(TIME'00:00:00.0', INTERVAL 100000000000000000.1 SECOND)
+NULL
+Warnings:
+Warning	1441	Datetime function: time field overflow
+SELECT DATE_ADD(TIME'00:00:00.0', INTERVAL 1000000000000000000000.1 SECOND);
+DATE_ADD(TIME'00:00:00.0', INTERVAL 1000000000000000000000.1 SECOND)
+00:00:00.0
+Warnings:
+Warning	1292	Truncated incorrect DECIMAL value: ''
 CREATE TABLE t1 AS SELECT
 DATE_ADD(TIME'00:00:00', INTERVAL 1 SECOND) AS t0s0,
 DATE_ADD(TIME'00:00:00', INTERVAL 1.1 SECOND) AS t0s1,
@@ -7002,6 +7029,21 @@ ERROR 42000: Too big precision 7 specifi
 CREATE TABLE t1 (a DATETIME(31));
 ERROR 42000: Too big precision 31 specified for column 'a'. Maximum is 6.
 #
+# Testing bad FSPs with DATETIME functions
+#
+SELECT SYSDATE(-1);
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '-1)' at line 1
+SELECT SYSDATE(7);
+ERROR 42000: Too big precision 7 specified for column 'sysdate'. Maximum is 6.
+SELECT SYSDATE(31);
+ERROR 42000: Too big precision 31 specified for column 'sysdate'. Maximum is 6.
+SELECT NOW(-1);
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '-1)' at line 1
+SELECT NOW(7);
+ERROR 42000: Too big precision 7 specified for column 'now'. Maximum is 6.
+SELECT NOW(31);
+ERROR 42000: Too big precision 31 specified for column 'now'. Maximum is 6.
+#
 # Testing INSERT, ORDER, KEY, BETWEEN, comparison
 #
 CREATE TABLE t1 (a DATETIME(6) NOT NULL);
@@ -16719,6 +16761,15 @@ NULL
 SELECT UNIX_TIMESTAMP(TIMESTAMP(NULL));
 UNIX_TIMESTAMP(TIMESTAMP(NULL))
 NULL
+SELECT CONCAT(UNIX_TIMESTAMP(NULL));
+CONCAT(UNIX_TIMESTAMP(NULL))
+NULL
+SELECT CAST(UNIX_TIMESTAMP(NULL) AS SIGNED);
+CAST(UNIX_TIMESTAMP(NULL) AS SIGNED)
+NULL
+SELECT CAST(UNIX_TIMESTAMP(NULL) AS DECIMAL(23,6));
+CAST(UNIX_TIMESTAMP(NULL) AS DECIMAL(23,6))
+NULL
 # This should return 0
 CREATE TABLE t1 (a VARCHAR(30));
 INSERT INTO t1 VALUES

=== modified file 'mysql-test/t/type_temporal_fractional.test'
--- a/mysql-test/t/type_temporal_fractional.test	2011-11-19 19:47:50 +0000
+++ b/mysql-test/t/type_temporal_fractional.test	2011-11-21 11:05:05 +0000
@@ -441,6 +441,16 @@ CREATE TABLE t1 (a TIME(7));
 CREATE TABLE t1 (a TIME(31));
 
 --echo #
+--echo # Testing bad FSPs with TIME functions
+--echo #
+--error ER_PARSE_ERROR
+SELECT CURTIME(-1);
+--error ER_TOO_BIG_PRECISION
+SELECT CURTIME(7);
+--error ER_TOO_BIG_PRECISION
+SELECT CURTIME(31);
+
+--echo #
 --echo # Testing INSERT, ORDER, KEY, BETWEEN, comparison
 --echo #
 CREATE TABLE t1 (a TIME(6) NOT NULL);
@@ -1947,6 +1957,11 @@ DROP TABLE t1;
 --echo # Testing hybrid functions in TIME context
 --echo #
 
+SELECT DATE_ADD(TIME'00:00:00.0', INTERVAL 10.1 SECOND);
+SELECT DATE_ADD(TIME'00:00:00.0', INTERVAL 10000000.1 SECOND);
+SELECT DATE_ADD(TIME'00:00:00.0', INTERVAL 100000000000000000.1 SECOND);
+SELECT DATE_ADD(TIME'00:00:00.0', INTERVAL 1000000000000000000000.1 SECOND);
+
 CREATE TABLE t1 AS SELECT
   DATE_ADD(TIME'00:00:00', INTERVAL 1 SECOND) AS t0s0,
   DATE_ADD(TIME'00:00:00', INTERVAL 1.1 SECOND) AS t0s1,
@@ -2239,6 +2254,24 @@ CREATE TABLE t1 (a DATETIME(7));
 CREATE TABLE t1 (a DATETIME(31));
 
 --echo #
+--echo # Testing bad FSPs with DATETIME functions
+--echo #
+--error ER_PARSE_ERROR
+SELECT SYSDATE(-1);
+--error ER_TOO_BIG_PRECISION
+SELECT SYSDATE(7);
+--error ER_TOO_BIG_PRECISION
+SELECT SYSDATE(31);
+--error ER_PARSE_ERROR
+SELECT NOW(-1);
+--error ER_TOO_BIG_PRECISION
+SELECT NOW(7);
+--error ER_TOO_BIG_PRECISION
+SELECT NOW(31);
+
+
+
+--echo #
 --echo # Testing INSERT, ORDER, KEY, BETWEEN, comparison
 --echo #
 CREATE TABLE t1 (a DATETIME(6) NOT NULL);
@@ -7278,6 +7311,9 @@ SELECT UNIX_TIMESTAMP(NULL);
 SELECT UNIX_TIMESTAMP(DATE(NULL));
 SELECT UNIX_TIMESTAMP(TIME(NULL));
 SELECT UNIX_TIMESTAMP(TIMESTAMP(NULL));
+SELECT CONCAT(UNIX_TIMESTAMP(NULL));
+SELECT CAST(UNIX_TIMESTAMP(NULL) AS SIGNED);
+SELECT CAST(UNIX_TIMESTAMP(NULL) AS DECIMAL(23,6));
 
 --echo # This should return 0
 CREATE TABLE t1 (a VARCHAR(30));

=== modified file 'sql/item_timefunc.cc'
--- a/sql/item_timefunc.cc	2011-11-18 13:26:35 +0000
+++ b/sql/item_timefunc.cc	2011-11-21 11:05:05 +0000
@@ -830,17 +830,6 @@ int Item_temporal_hybrid_func::save_in_f
 }
 
 
-longlong Item_temporal_hybrid_func::val_temporal()
-{
-  DBUG_ASSERT(fixed == 1);
-  DBUG_ASSERT(is_temporal());
-  MYSQL_TIME ltime;
-  return 
-    val_datetime(&ltime, TIME_FUZZY_DATE | sql_mode) ?
-    0 : TIME_to_longlong_packed(&ltime, cached_field_type);
-}
-
-
 my_decimal *Item_temporal_hybrid_func::val_decimal(my_decimal *decimal_value)
 {
   DBUG_ASSERT(fixed == 1);

=== modified file 'sql/item_timefunc.h'
--- a/sql/item_timefunc.h	2011-11-17 13:41:28 +0000
+++ b/sql/item_timefunc.h	2011-11-21 11:05:05 +0000
@@ -572,7 +572,6 @@ public:
   double val_real() { return val_real_from_decimal(); }
   my_decimal *val_decimal(my_decimal *decimal_value);
   int save_in_field(Field *field, bool no_conversions);
-  longlong val_temporal();
   /**
     Return string value in ASCII character set.
   */

No bundle (reason: useless for push emails).
Thread
bzr push into mysql-trunk branch (alexander.barkov:3601 to 3602) WL#946Alexander Barkov22 Nov