List:Commits« Previous MessageNext Message »
From:Georgi Kodinov Date:August 13 2010 1:05pm
Subject:bzr commit into mysql-5.1-bugteam branch (Georgi.Kodinov:3482) Bug#55565
View as plain text  
#At file:///home/kgeorge/mysql/work/B55565-5.1-bugteam/ based on revid:martin.hansson@stripped

 3482 Georgi Kodinov	2010-08-13
      Bug #55565: debug assertion when ordering by expressions with user 
      variable assignments
      
      The assert() that is firing is checking if expressions that can't be
      null return a NULL when evaluated.
      MAKEDATE() function can return NULL if the second argument is 
      less then or equal to 0. Thus its nullability depends not only on 
      the nullability of its arguments but also on their values.
      Fixed by (overoptimistically) setting MAKEDATE() to be nullable 
      despite the nullability of its arguments.
      Test added.
      Had to update one test result to reflect the metadata change.

    modified:
      mysql-test/r/func_sapdb.result
      mysql-test/r/func_time.result
      mysql-test/t/func_time.test
      sql/item_timefunc.h
=== modified file 'mysql-test/r/func_sapdb.result'
--- a/mysql-test/r/func_sapdb.result	2009-02-07 15:50:31 +0000
+++ b/mysql-test/r/func_sapdb.result	2010-08-13 13:05:46 +0000
@@ -194,7 +194,7 @@ date("1997-12-31 23:59:59.000001") as f8
 time("1997-12-31 23:59:59.000001") as f9;
 describe t1;
 Field	Type	Null	Key	Default	Extra
-f1	date	NO		0000-00-00	
+f1	date	YES		NULL	
 f2	datetime	YES		NULL	
 f3	time	YES		NULL	
 f4	time	YES		NULL	

=== modified file 'mysql-test/r/func_time.result'
--- a/mysql-test/r/func_time.result	2010-02-09 10:30:50 +0000
+++ b/mysql-test/r/func_time.result	2010-08-13 13:05:46 +0000
@@ -1335,4 +1335,12 @@ date_sub("0069-01-01 00:00:01",INTERVAL 
 select date_sub("0169-01-01 00:00:01",INTERVAL 2 SECOND);
 date_sub("0169-01-01 00:00:01",INTERVAL 2 SECOND)
 0168-12-31 23:59:59
+CREATE TABLE t1(a DOUBLE NOT NULL);
+INSERT INTO t1 VALUES (0),(9.216e-096);
+# should not crash
+SELECT 1 FROM t1 ORDER BY @x:=makedate(a,a);
+1
+1
+1
+DROP TABLE t1;
 End of 5.1 tests

=== modified file 'mysql-test/t/func_time.test'
--- a/mysql-test/t/func_time.test	2009-01-23 12:22:05 +0000
+++ b/mysql-test/t/func_time.test	2010-08-13 13:05:46 +0000
@@ -838,4 +838,15 @@ select date_sub("0069-01-01 00:00:01",IN
 select date_sub("0169-01-01 00:00:01",INTERVAL 2 SECOND);
 
 
+#
+# Bug #55565: debug assertion when ordering by expressions with user
+# variable assignments
+#
+
+CREATE TABLE t1(a DOUBLE NOT NULL);
+INSERT INTO t1 VALUES (0),(9.216e-096);
+--echo # should not crash
+SELECT 1 FROM t1 ORDER BY @x:=makedate(a,a);
+DROP TABLE t1;
+
 --echo End of 5.1 tests

=== modified file 'sql/item_timefunc.h'
--- a/sql/item_timefunc.h	2009-12-13 20:29:50 +0000
+++ b/sql/item_timefunc.h	2010-08-13 13:05:46 +0000
@@ -881,6 +881,8 @@ public:
   { 
     decimals=0;
     max_length=MAX_DATE_WIDTH*MY_CHARSET_BIN_MB_MAXLEN;
+    /* It returns NULL when the second argument is less or equal to 0 */
+    maybe_null= 1;
   }
   longlong val_int();
 };


Attachment: [text/bzr-bundle] bzr/georgi.kodinov@oracle.com-20100813130546-l7xj1x2jywsu6rru.bundle
Thread
bzr commit into mysql-5.1-bugteam branch (Georgi.Kodinov:3482) Bug#55565Georgi Kodinov13 Aug