Commit 84a53543 authored by Sergey Petrunya's avatar Sergey Petrunya

BUG#965872: Server crashes in embedding_sjm on a simple 1-table select with AND and OR

- This is a regession introduced by fix for BUG#951937
- The problem was that there were scenarios where check_simple_equality() would create an
  Item_equal object but would not call item_equal->set_context_field() on it. 
- The fix was to add the missing calls.
parent ff731f39
...@@ -1043,6 +1043,15 @@ y y ...@@ -1043,6 +1043,15 @@ y y
y y y y
DROP VIEW v1; DROP VIEW v1;
DROP TABLE t1, t2; DROP TABLE t1, t2;
#
# BUG#965872: Server crashes in embedding_sjm on a simple 1-table select with AND and OR
# (this is a regression caused by the fix for BUG#951937)
CREATE TABLE t1 ( a INT, b INT, c INT, d INT );
INSERT INTO t1 VALUES (4,2,8,9),(4,2,7,8);
SELECT * FROM t1
WHERE a = d AND ( b = 50 AND b = d OR a = c );
a b c d
DROP TABLE t1;
# #
# BUG#951283: Wrong result (missing rows) with semijoin+firstmatch, IN/ANY subquery # BUG#951283: Wrong result (missing rows) with semijoin+firstmatch, IN/ANY subquery
# #
......
...@@ -1057,6 +1057,15 @@ y y ...@@ -1057,6 +1057,15 @@ y y
y y y y
DROP VIEW v1; DROP VIEW v1;
DROP TABLE t1, t2; DROP TABLE t1, t2;
#
# BUG#965872: Server crashes in embedding_sjm on a simple 1-table select with AND and OR
# (this is a regression caused by the fix for BUG#951937)
CREATE TABLE t1 ( a INT, b INT, c INT, d INT );
INSERT INTO t1 VALUES (4,2,8,9),(4,2,7,8);
SELECT * FROM t1
WHERE a = d AND ( b = 50 AND b = d OR a = c );
a b c d
DROP TABLE t1;
# #
# BUG#951283: Wrong result (missing rows) with semijoin+firstmatch, IN/ANY subquery # BUG#951283: Wrong result (missing rows) with semijoin+firstmatch, IN/ANY subquery
# #
......
...@@ -1045,6 +1045,15 @@ y y ...@@ -1045,6 +1045,15 @@ y y
y y y y
DROP VIEW v1; DROP VIEW v1;
DROP TABLE t1, t2; DROP TABLE t1, t2;
#
# BUG#965872: Server crashes in embedding_sjm on a simple 1-table select with AND and OR
# (this is a regression caused by the fix for BUG#951937)
CREATE TABLE t1 ( a INT, b INT, c INT, d INT );
INSERT INTO t1 VALUES (4,2,8,9),(4,2,7,8);
SELECT * FROM t1
WHERE a = d AND ( b = 50 AND b = d OR a = c );
a b c d
DROP TABLE t1;
# #
# BUG#951283: Wrong result (missing rows) with semijoin+firstmatch, IN/ANY subquery # BUG#951283: Wrong result (missing rows) with semijoin+firstmatch, IN/ANY subquery
# #
......
...@@ -1175,6 +1175,16 @@ SELECT * FROM t2 ...@@ -1175,6 +1175,16 @@ SELECT * FROM t2
DROP VIEW v1; DROP VIEW v1;
DROP TABLE t1, t2; DROP TABLE t1, t2;
--echo #
--echo # BUG#965872: Server crashes in embedding_sjm on a simple 1-table select with AND and OR
--echo # (this is a regression caused by the fix for BUG#951937)
CREATE TABLE t1 ( a INT, b INT, c INT, d INT );
INSERT INTO t1 VALUES (4,2,8,9),(4,2,7,8);
SELECT * FROM t1
WHERE a = d AND ( b = 50 AND b = d OR a = c );
DROP TABLE t1;
--echo # --echo #
--echo # BUG#951283: Wrong result (missing rows) with semijoin+firstmatch, IN/ANY subquery --echo # BUG#951283: Wrong result (missing rows) with semijoin+firstmatch, IN/ANY subquery
--echo # --echo #
......
...@@ -10788,6 +10788,7 @@ static bool check_simple_equality(Item *left_item, Item *right_item, ...@@ -10788,6 +10788,7 @@ static bool check_simple_equality(Item *left_item, Item *right_item,
Item_equal *item_equal= new Item_equal(orig_left_item, Item_equal *item_equal= new Item_equal(orig_left_item,
orig_right_item, orig_right_item,
FALSE); FALSE);
item_equal->set_context_field((Item_field*)left_item);
cond_equal->current_level.push_back(item_equal); cond_equal->current_level.push_back(item_equal);
} }
} }
...@@ -10858,6 +10859,7 @@ static bool check_simple_equality(Item *left_item, Item *right_item, ...@@ -10858,6 +10859,7 @@ static bool check_simple_equality(Item *left_item, Item *right_item,
else else
{ {
item_equal= new Item_equal(const_item, orig_field_item, TRUE); item_equal= new Item_equal(const_item, orig_field_item, TRUE);
item_equal->set_context_field(field_item);
cond_equal->current_level.push_back(item_equal); cond_equal->current_level.push_back(item_equal);
} }
return TRUE; return TRUE;
......
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