MySQL Lists are EOL. Please join:

List:Commits« Previous MessageNext Message »
From:ramil Date:November 21 2007 4:53pm
Subject:bk commit into 5.0 tree (ramil:1.2578) BUG#32558
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of ram. When ram 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-11-21 20:53:44+04:00, ramil@stripped +3 -0
  Fix for bug #32558: group by null-returning expression with rollup causes crash
  
  Problem: setting Item_func_rollup_const::null_value property to argument's null_value
  before (without) the argument evaluation may result in a crash due to wrong null_value.
  
  Fix: use is_null() to set Item_func_rollup_const::null_value instead as it evaluates
  the argument if necessary and returns a proper value.

  mysql-test/r/olap.result@stripped, 2007-11-21 20:53:42+04:00, ramil@stripped +8 -0
    Fix for bug #32558: group by null-returning expression with rollup causes crash
      - test result.

  mysql-test/t/olap.test@stripped, 2007-11-21 20:53:42+04:00, ramil@stripped +9 -0
    Fix for bug #32558: group by null-returning expression with rollup causes crash
      - test case.

  sql/item_func.h@stripped, 2007-11-21 20:53:42+04:00, ramil@stripped +1 -1
    Fix for bug #32558: group by null-returning expression with rollup causes crash
      - use args[0]->is_null() to obtain Item_func_rollup_const::null_value 
        instead of args[0]->null_value as it's not set in advance in case of 
        constant functions.

diff -Nrup a/mysql-test/r/olap.result b/mysql-test/r/olap.result
--- a/mysql-test/r/olap.result	2007-10-02 01:02:07 +05:00
+++ b/mysql-test/r/olap.result	2007-11-21 20:53:42 +04:00
@@ -726,3 +726,11 @@ count(a)
 3
 drop table t1;
 ##############################################################
+CREATE TABLE t1(a INT);
+INSERT INTO t1 VALUES(0);
+SELECT 1 FROM t1 GROUP BY (DATE(NULL)) WITH ROLLUP;
+1
+1
+1
+DROP TABLE t1;
+End of 5.0 tests
diff -Nrup a/mysql-test/t/olap.test b/mysql-test/t/olap.test
--- a/mysql-test/t/olap.test	2007-10-02 01:02:05 +05:00
+++ b/mysql-test/t/olap.test	2007-11-21 20:53:42 +04:00
@@ -367,3 +367,12 @@ select count(a) from t1 group by null wi
 drop table t1;
 --echo ##############################################################
 
+#
+# Bug #32558: group by null-returning expression with rollup causes crash
+#
+CREATE TABLE t1(a INT);
+INSERT INTO t1 VALUES(0);
+SELECT 1 FROM t1 GROUP BY (DATE(NULL)) WITH ROLLUP;
+DROP TABLE t1;
+
+--echo End of 5.0 tests
diff -Nrup a/sql/item_func.h b/sql/item_func.h
--- a/sql/item_func.h	2007-10-29 15:39:54 +04:00
+++ b/sql/item_func.h	2007-11-21 20:53:42 +04:00
@@ -782,7 +782,7 @@ public:
     max_length= args[0]->max_length;
     decimals=args[0]->decimals; 
     /* The item could be a NULL constant. */
-    null_value= args[0]->null_value;
+    null_value= args[0]->is_null();
   }
 };
 
Thread
bk commit into 5.0 tree (ramil:1.2578) BUG#32558ramil21 Nov