mirror of
https://github.com/MariaDB/server.git
synced 2025-01-29 10:14:19 +01:00
Fixed a bug in GREATES() and LEAST() function, that caused a core
dump when result was NULL. mysql-test/r/func_test.result: Added a test for GREATEST() and LEAST() core dump bug. mysql-test/t/func_test.test: Added a test for GREATEST() and LEAST() core dump bug.
This commit is contained in:
parent
d01e810128
commit
96abffd4a4
3 changed files with 16 additions and 0 deletions
|
@ -165,3 +165,9 @@ SELECT f_acc.rank, a1.rank, a2.rank FROM t1 LEFT JOIN t1 f1 ON (f1.access_id=1
|
|||
rank rank rank
|
||||
2 2 NULL
|
||||
DROP TABLE t1,t2;
|
||||
CREATE TABLE t1 (d varchar(6), k int);
|
||||
INSERT INTO t1 VALUES (NULL, 2);
|
||||
SELECT GREATEST(d,d) FROM t1 WHERE k=2;
|
||||
GREATEST(d,d)
|
||||
NULL
|
||||
DROP TABLE t1;
|
||||
|
|
|
@ -85,3 +85,11 @@ CREATE TABLE t2 ( access_id smallint(6) NOT NULL default '0', name varchar(20
|
|||
INSERT INTO t2 VALUES (1,'Everyone',2),(2,'Help',3),(3,'Customer Support',1);
|
||||
SELECT f_acc.rank, a1.rank, a2.rank FROM t1 LEFT JOIN t1 f1 ON (f1.access_id=1 AND f1.faq_group_id = t1.faq_group_id) LEFT JOIN t2 a1 ON (a1.access_id = f1.access_id) LEFT JOIN t1 f2 ON (f2.access_id=3 AND f2.faq_group_id = t1.faq_group_id) LEFT JOIN t2 a2 ON (a2.access_id = f2.access_id), t2 f_acc WHERE LEAST(a1.rank,a2.rank) = f_acc.rank;
|
||||
DROP TABLE t1,t2;
|
||||
|
||||
#
|
||||
# Test for GREATEST() and LEAST() bug, which segfaulted 4.1.1 server
|
||||
#
|
||||
CREATE TABLE t1 (d varchar(6), k int);
|
||||
INSERT INTO t1 VALUES (NULL, 2);
|
||||
SELECT GREATEST(d,d) FROM t1 WHERE k=2;
|
||||
DROP TABLE t1;
|
||||
|
|
|
@ -1068,6 +1068,8 @@ String *Item_func_min_max::val_str(String *str)
|
|||
}
|
||||
}
|
||||
}
|
||||
if (!res) // If NULL
|
||||
return 0;
|
||||
res->set_charset(collation.collation);
|
||||
return res;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue