Below is the list of changes that have just been committed into a local
5.0 repository of evgen. When evgen 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-29 00:22:54+00:00, evgen@stripped +3 -0
Bug#31095: Unexpected NULL constant caused server crash.
The Item_func_rollup_const class is used for wrapping constants to avoid
wrong result for ROLLUP queries with DISTINCT and a constant in the select
list. This class is also used to wrap up a NULL constant but its null_value
wasn't set accordingly. This led to a server crash.
Now the null_value of an object of the Item_func_rollup_const class is set
by the JOIN::rollup_init function when the object is used to wrap a NULL
constant.
mysql-test/r/olap.result@stripped, 2007-09-29 00:20:01+00:00, evgen@stripped +11 -0
Added a test case for the bug#31095: Unexpected NULL constant caused server crash.
mysql-test/t/olap.test@stripped, 2007-09-29 00:19:47+00:00, evgen@stripped +9 -0
Added a test case for the bug#31095: Unexpected NULL constant caused server crash.
sql/sql_select.cc@stripped, 2007-09-29 00:20:14+00:00, evgen@stripped +2 -0
Bug#31095: Unexpected NULL constant caused server crash.
Now the null_value of an object of the Item_func_rollup_const class is set
by the JOIN::rollup_init function when the object is used to wrap a NULL
constant.
diff -Nrup a/mysql-test/r/olap.result b/mysql-test/r/olap.result
--- a/mysql-test/r/olap.result 2007-05-30 06:55:36 +00:00
+++ b/mysql-test/r/olap.result 2007-09-29 00:20:01 +00:00
@@ -715,3 +715,14 @@ a SUM(a)
4 4
NULL 14
DROP TABLE t1;
+#
+# Bug#31095: Unexpected NULL value constant server crash.
+#
+create table t1(a int);
+insert into t1 values (1),(2),(3);
+select a,count(a) from t1 group by null with rollup;
+a count(a)
+1 3
+1 3
+drop table t1;
+##############################################################
diff -Nrup a/mysql-test/t/olap.test b/mysql-test/t/olap.test
--- a/mysql-test/t/olap.test 2007-04-30 01:32:57 +00:00
+++ b/mysql-test/t/olap.test 2007-09-29 00:19:47 +00:00
@@ -358,3 +358,12 @@ SELECT * FROM (SELECT a, SUM(a) FROM t1
DROP TABLE t1;
+--echo #
+--echo # Bug#31095: Unexpected NULL constant caused server crash.
+--echo #
+create table t1(a int);
+insert into t1 values (1),(2),(3);
+select a,count(a) from t1 group by null with rollup;
+drop table t1;
+--echo ##############################################################
+
diff -Nrup a/sql/sql_select.cc b/sql/sql_select.cc
--- a/sql/sql_select.cc 2007-09-24 12:34:09 +00:00
+++ b/sql/sql_select.cc 2007-09-29 00:20:14 +00:00
@@ -14734,6 +14734,8 @@ bool JOIN::rollup_init()
if (!new_item)
return 1;
new_item->fix_fields(thd, (Item **) 0);
+ /* The item could be a NULL constant. */
+ new_item->null_value= item->null_value;
thd->change_item_tree(it.ref(), new_item);
for (ORDER *tmp= group_tmp; tmp; tmp= tmp->next)
{
| Thread |
|---|
| • bk commit into 5.0 tree (evgen:1.2539) BUG#31095 | eugene | 28 Sep |