Skip to content

Commit

Permalink
MDEV-10347 mysqld got signal 11
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexander Barkov committed Nov 2, 2016
1 parent 554c60a commit c18054d
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 0 deletions.
17 changes: 17 additions & 0 deletions mysql-test/r/null.result
Original file line number Diff line number Diff line change
Expand Up @@ -1572,6 +1572,23 @@ SELECT * FROM t1 WHERE NULLIF(NULLIF(NULLIF(NULLIF(NULLIF(NULLIF(NULLIF(NULLIF(N
i
DROP TABLE t1;
#
# MDEV-10347 mysqld got signal 11
#
CREATE TABLE t1 (f1 VARCHAR(10), f2 VARCHAR(40));
CREATE TABLE t2 (f3 VARCHAR(20));
PREPARE stmt FROM "
SELECT (
SELECT IFNULL(f3,4) FROM t2
WHERE IFNULL(NULLIF(f1,''),1)
) AS sq
FROM t1
GROUP BY f2
";
EXECUTE stmt;
sq
DEALLOCATE PREPARE stmt;
DROP TABLE t2,t1;
#
# MDEV-10236 Where expression with NOT function gives incorrect result
#
CREATE TABLE t1 (c1 INT);
Expand Down
17 changes: 17 additions & 0 deletions mysql-test/t/null.test
Original file line number Diff line number Diff line change
Expand Up @@ -1006,6 +1006,23 @@ INSERT INTO t1 VALUES (1),(2);
SELECT * FROM t1 WHERE NULLIF(NULLIF(NULLIF(NULLIF(NULLIF(NULLIF(NULLIF(NULLIF(NULLIF(NULLIF(NULLIF(NULLIF(NULLIF(NULLIF(i = ROUND(0), 14), 13), 12), 11), 10), 9), 8), 7), 6), 5), 4), 3), 2), 1);
DROP TABLE t1;

--echo #
--echo # MDEV-10347 mysqld got signal 11
--echo #

CREATE TABLE t1 (f1 VARCHAR(10), f2 VARCHAR(40));
CREATE TABLE t2 (f3 VARCHAR(20));
PREPARE stmt FROM "
SELECT (
SELECT IFNULL(f3,4) FROM t2
WHERE IFNULL(NULLIF(f1,''),1)
) AS sq
FROM t1
GROUP BY f2
";
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
DROP TABLE t2,t1;

--echo #
--echo # MDEV-10236 Where expression with NOT function gives incorrect result
Expand Down
5 changes: 5 additions & 0 deletions sql/item_cmpfunc.h
Original file line number Diff line number Diff line change
Expand Up @@ -1022,6 +1022,11 @@ class Item_func_nullif :public Item_func_hybrid_field_type
Item_func_hybrid_field_type(thd, a, b, a),
m_cache(NULL)
{ arg_count--; }
void cleanup()
{
Item_func_hybrid_field_type::cleanup();
arg_count= 2; // See the comment to the constructor
}
bool date_op(MYSQL_TIME *ltime, uint fuzzydate);
double real_op();
longlong int_op();
Expand Down

0 comments on commit c18054d

Please sign in to comment.