List:Commits« Previous MessageNext Message »
From:Alexander Barkov Date:January 12 2012 9:06am
Subject:bzr push into mysql-5.5 branch (alexander.barkov:3681 to 3682) Bug#13354387
View as plain text  
 3682 Alexander Barkov	2012-01-12
      BUG#13354387 - CRASH IN IN MY_DECIMAL::OPERATOR FOR VIEW AND FUNCTION UNIX_TIME
      
      Fixing the 5.5 part (the 5.6 part will go in a separate commit soon).
      
      Problem:
        Item_direct_ref::get_date() incorrectly calculated its "null_value",
        which made UNIX_TIMESTAMP(view_column) incorrectly return NULL
        for a NOT NULL view_column.
      
      Fix:
        Make Item_direct_ref::get_date() calculate null_value
        in the similar way with the other methods 
        (val_real,val_str,val_int,val_decimal):
        copy null_value from the referenced Item.
      
      modified:
        mysql-test/r/func_time.result
        mysql-test/t/func_time.test
        sql/item.cc

    modified:
      mysql-test/r/func_time.result
      mysql-test/t/func_time.test
      sql/item.cc
 3681 hery.ramilison@stripped	2012-01-11 [merge]
      Merge from mysql-5.5.20-release

    modified:
      mysql-test/r/key_cache.result
      mysql-test/r/mysqlcheck.result
      mysql-test/r/partition_key_cache.result
      mysql-test/t/key_cache.test
      mysql-test/t/mysqlcheck.test
      mysql-test/t/partition_key_cache.test
      sql/sql_admin.cc
      storage/myisam/mi_preload.c
=== modified file 'mysql-test/r/func_time.result'
--- a/mysql-test/r/func_time.result	2011-07-27 08:51:55 +0000
+++ b/mysql-test/r/func_time.result	2012-01-12 09:02:51 +0000
@@ -1433,6 +1433,21 @@ NULL	1	NULL
 SET storage_engine=NULL;
 ERROR 42000: Variable 'storage_engine' can't be set to the value of 'NULL'
 #
+# BUG#13354387 - CRASH IN IN MY_DECIMAL::OPERATOR FOR VIEW AND FUNCTION UNIX_TIMESTAMP 
+# Part1 (5.5)
+SET time_zone='+03:00';
+CREATE TABLE t1 (a DATETIME NOT NULL);
+INSERT INTO t1 VALUES ('2009-09-20 07:32:39.06');
+INSERT INTO t1 VALUES ('0000-00-00 00:00:00.00');
+CREATE VIEW v1 AS SELECT * FROM t1;
+SELECT CAST(UNIX_TIMESTAMP(a) AS DECIMAL(25,3)) AS c1 FROM v1 ORDER BY 1;
+c1
+0.000
+1253421159.000
+DROP VIEW v1;
+DROP TABLE t1;
+SET time_zone=DEFAULT;
+#
 # Bug #59686 crash in String::copy() with time data type
 #
 SELECT min(timestampadd(month, 1>'', from_days('%Z')));

=== modified file 'mysql-test/t/func_time.test'
--- a/mysql-test/t/func_time.test	2011-07-27 08:51:55 +0000
+++ b/mysql-test/t/func_time.test	2012-01-12 09:02:51 +0000
@@ -940,6 +940,21 @@ SELECT MONTHNAME(0), MONTHNAME(0) IS NUL
 --error ER_WRONG_VALUE_FOR_VAR
 SET storage_engine=NULL;
 
+
+--echo #
+--echo # BUG#13354387 - CRASH IN IN MY_DECIMAL::OPERATOR FOR VIEW AND FUNCTION UNIX_TIMESTAMP 
+--echo # Part1 (5.5)
+SET time_zone='+03:00';
+CREATE TABLE t1 (a DATETIME NOT NULL);
+INSERT INTO t1 VALUES ('2009-09-20 07:32:39.06');
+INSERT INTO t1 VALUES ('0000-00-00 00:00:00.00');
+CREATE VIEW v1 AS SELECT * FROM t1;
+SELECT CAST(UNIX_TIMESTAMP(a) AS DECIMAL(25,3)) AS c1 FROM v1 ORDER BY 1; 
+DROP VIEW v1;
+DROP TABLE t1;
+SET time_zone=DEFAULT;
+
+
 --echo #
 --echo # Bug #59686 crash in String::copy() with time data type
 --echo #

=== modified file 'sql/item.cc'
--- a/sql/item.cc	2011-12-05 14:42:45 +0000
+++ b/sql/item.cc	2012-01-12 09:02:51 +0000
@@ -6812,7 +6812,9 @@ bool Item_direct_ref::is_null()
 
 bool Item_direct_ref::get_date(MYSQL_TIME *ltime,uint fuzzydate)
 {
-  return (null_value=(*ref)->get_date(ltime,fuzzydate));
+  bool tmp= (*ref)->get_date(ltime, fuzzydate);
+  null_value= (*ref)->null_value;
+  return tmp;
 }
 
 

No bundle (reason: useless for push emails).
Thread
bzr push into mysql-5.5 branch (alexander.barkov:3681 to 3682) Bug#13354387Alexander Barkov12 Jan