Description:
mysqld core dumps if LEAST() or GREATEST() should return a NULL.
How to repeat:
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (d varchar(6), k int);
INSERT INTO t1 VALUES (NULL, 2);
SELECT GREATEST(d,d) FROM t1 WHERE k=2;
Suggested fix:
*** sql/item_func.cc.org 2004-01-28 18:42:26.000000000 +0200
--- sql/item_func.cc 2004-01-28 18:42:32.000000000 +0200
***************
*** 1068,1073 ****
--- 1068,1075 ----
}
}
}
+ if (!res) // If NULL
+ return 0;
res->set_charset(collation.collation);
return res;
}
Description: mysqld core dumps if LEAST() or GREATEST() should return a NULL. How to repeat: DROP TABLE IF EXISTS t1; CREATE TABLE t1 (d varchar(6), k int); INSERT INTO t1 VALUES (NULL, 2); SELECT GREATEST(d,d) FROM t1 WHERE k=2; Suggested fix: *** sql/item_func.cc.org 2004-01-28 18:42:26.000000000 +0200 --- sql/item_func.cc 2004-01-28 18:42:32.000000000 +0200 *************** *** 1068,1073 **** --- 1068,1075 ---- } } } + if (!res) // If NULL + return 0; res->set_charset(collation.collation); return res; }