Commit 73be194f authored by igor@rurik.mysql.com's avatar igor@rurik.mysql.com

subselect.test, subselect.result:

  Added a test case for bug #12392.
item_cmpfunc.cc:
  Fixed bug #12392.
  Missing handling of rows containing NULL components
  when evaluating IN predicates caused a crash.
parent 0ff109f1
...@@ -2742,3 +2742,9 @@ one two flag ...@@ -2742,3 +2742,9 @@ one two flag
5 6 N 5 6 N
7 8 N 7 8 N
DROP TABLE t1,t2; DROP TABLE t1,t2;
CREATE TABLE t1 (a char(5), b char(5));
INSERT INTO t1 VALUES (NULL,'aaa'), ('aaa','aaa');
SELECT * FROM t1 WHERE (a,b) IN (('aaa','aaa'), ('aaa','bbb'));
a b
aaa aaa
DROP TABLE t1;
...@@ -1770,4 +1770,15 @@ SELECT * FROM t1 ...@@ -1770,4 +1770,15 @@ SELECT * FROM t1
DROP TABLE t1,t2; DROP TABLE t1,t2;
#
# Bug #12392: where cond with IN predicate for rows and NULL values in table
#
CREATE TABLE t1 (a char(5), b char(5));
INSERT INTO t1 VALUES (NULL,'aaa'), ('aaa','aaa');
SELECT * FROM t1 WHERE (a,b) IN (('aaa','aaa'), ('aaa','bbb'));
DROP TABLE t1;
# End of 4.1 tests # End of 4.1 tests
...@@ -1551,6 +1551,8 @@ in_row::~in_row() ...@@ -1551,6 +1551,8 @@ in_row::~in_row()
byte *in_row::get_value(Item *item) byte *in_row::get_value(Item *item)
{ {
tmp.store_value(item); tmp.store_value(item);
if (item->is_null())
return 0;
return (byte *)&tmp; return (byte *)&tmp;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment