List:Commits« Previous MessageNext Message »
From:mhansson Date:September 24 2007 3:32pm
Subject:bk commit into 5.1 tree (mhansson:1.2572) BUG#31160
View as plain text  
Below is the list of changes that have just been committed into a local
5.1 repository of martin. When martin does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet@stripped, 2007-09-24 17:32:21+02:00, mhansson@stripped +4 -0
  Bug#31160: MAKETIME() crashes server when returning NULL in ORDER BY using filesort
  
  Even though it returns NULL, the MAKETIME function did not have this property set,
  causing a failed assertion (designed to catch exactly this).
  Fixed by setting the nullability property of MAKETIME().

  mysql-test/r/func_sapdb.result@stripped, 2007-09-24 17:32:18+02:00, mhansson@stripped +1 -1
    Bug#31160: Changed test result.

  mysql-test/r/func_time.result@stripped, 2007-09-24 17:32:18+02:00, mhansson@stripped +9 -0
    Bug#31160: Test result.

  mysql-test/t/func_time.test@stripped, 2007-09-24 17:32:18+02:00, mhansson@stripped +10 -0
    Bug#31160: Test case.

  sql/item_timefunc.h@stripped, 2007-09-24 17:32:18+02:00, mhansson@stripped +4 -1
    Bug#31160: The fix: Initializing maybe_null to true

diff -Nrup a/mysql-test/r/func_sapdb.result b/mysql-test/r/func_sapdb.result
--- a/mysql-test/r/func_sapdb.result	2007-05-16 12:49:36 +02:00
+++ b/mysql-test/r/func_sapdb.result	2007-09-24 17:32:18 +02:00
@@ -196,7 +196,7 @@ f2	datetime	YES		NULL	
 f3	time	YES		NULL	
 f4	time	YES		NULL	
 f5	time	YES		NULL	
-f6	time	NO		00:00:00	
+f6	time	YES		NULL	
 f7	datetime	YES		NULL	
 f8	date	YES		NULL	
 f9	time	YES		NULL	
diff -Nrup a/mysql-test/r/func_time.result b/mysql-test/r/func_time.result
--- a/mysql-test/r/func_time.result	2007-03-23 21:08:27 +01:00
+++ b/mysql-test/r/func_time.result	2007-09-24 17:32:18 +02:00
@@ -1256,4 +1256,13 @@ 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 TIMESTAMP
+);
+INSERT INTO t1 VALUES (now()), (now());
+SELECT * FROM t1 ORDER BY MAKETIME(1, 1, a);
+a
+2007-09-24 18:31:02
+2007-09-24 18:31:02
+DROP TABLE t1;
 End of 5.1 tests
diff -Nrup a/mysql-test/t/func_time.test b/mysql-test/t/func_time.test
--- a/mysql-test/t/func_time.test	2007-03-07 10:24:08 +01:00
+++ b/mysql-test/t/func_time.test	2007-09-24 17:32:18 +02:00
@@ -749,5 +749,15 @@ select date_sub("90-01-01 00:00:01",INTE
 select date_sub("0069-01-01 00:00:01",INTERVAL 2 SECOND);
 select date_sub("0169-01-01 00:00:01",INTERVAL 2 SECOND);
 
+#
+# Bug #31160: MAKETIME() crashes server when returning NULL in ORDER BY using 
+# filesort
+#
+CREATE TABLE t1 (
+  a TIMESTAMP
+);
+INSERT INTO t1 VALUES (now()), (now());
+SELECT * FROM t1 ORDER BY MAKETIME(1, 1, a);
+DROP TABLE t1;
 
 --echo End of 5.1 tests
diff -Nrup a/sql/item_timefunc.h b/sql/item_timefunc.h
--- a/sql/item_timefunc.h	2007-06-13 16:12:00 +02:00
+++ b/sql/item_timefunc.h	2007-09-24 17:32:18 +02:00
@@ -936,7 +936,10 @@ class Item_func_maketime :public Item_st
 {
 public:
   Item_func_maketime(Item *a, Item *b, Item *c)
-    :Item_str_timefunc(a, b ,c) {}
+    :Item_str_timefunc(a, b ,c) 
+    {
+      maybe_null= true;
+    }
   String *val_str(String *str);
   const char *func_name() const { return "maketime"; }
 };
Thread
bk commit into 5.1 tree (mhansson:1.2572) BUG#31160mhansson24 Sep