mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
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 its fix_length_and_dec member function.
This commit is contained in:
@ -715,3 +715,14 @@ a SUM(a)
|
|||||||
4 4
|
4 4
|
||||||
NULL 14
|
NULL 14
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
|
#
|
||||||
|
# Bug#31095: Unexpected NULL constant caused server crash.
|
||||||
|
#
|
||||||
|
create table t1(a int);
|
||||||
|
insert into t1 values (1),(2),(3);
|
||||||
|
select count(a) from t1 group by null with rollup;
|
||||||
|
count(a)
|
||||||
|
3
|
||||||
|
3
|
||||||
|
drop table t1;
|
||||||
|
##############################################################
|
||||||
|
@ -358,3 +358,12 @@ SELECT * FROM (SELECT a, SUM(a) FROM t1 GROUP BY a WITH ROLLUP) as t;
|
|||||||
|
|
||||||
DROP TABLE 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 count(a) from t1 group by null with rollup;
|
||||||
|
drop table t1;
|
||||||
|
--echo ##############################################################
|
||||||
|
|
||||||
|
@ -749,6 +749,8 @@ public:
|
|||||||
collation= args[0]->collation;
|
collation= args[0]->collation;
|
||||||
max_length= args[0]->max_length;
|
max_length= args[0]->max_length;
|
||||||
decimals=args[0]->decimals;
|
decimals=args[0]->decimals;
|
||||||
|
/* The item could be a NULL constant. */
|
||||||
|
null_value= args[0]->null_value;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user