1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

Bug #55826: create table .. select crashes with when

KILL_BAD_DATA is returned

Two problems discovered with the LEAST()/GREATEST() 
functions:
1. The check for a null value should happen even 
after the second call to val_str() in the args. This is
important because two subsequent calls to the same
Item::val_str() may yield different results.
Fixed by checking for NULL value before dereferencing
the string result.

2. While looping over the arguments and evaluating them 
the loop should stop if there was an error evaluating so far
or the statement was killed. Fixed by checking for error
and bailing out.
This commit is contained in:
Georgi Kodinov
2010-08-20 11:52:16 +03:00
parent 62aa8943b8
commit 3b36a677ba
3 changed files with 43 additions and 1 deletions

View File

@ -751,4 +751,19 @@ UNLOCK TABLES;
DROP TABLE t1;
--echo #
--echo # Bug#55826: create table .. select crashes with when KILL_BAD_DATA
--echo # is returned
--echo #
CREATE TABLE t1(a INT) ENGINE=innodb;
INSERT INTO t1 VALUES (0);
SET SQL_MODE='STRICT_ALL_TABLES';
--error ER_TRUNCATED_WRONG_VALUE
CREATE TABLE t2
SELECT LEAST((SELECT '' FROM t1),NOW()) FROM `t1`;
DROP TABLE t1,t2;
SET SQL_MODE=DEFAULT;
--echo End of 5.1 tests