Commit 0a5026b0 authored by Sergey Petrunya's avatar Sergey Petrunya

Merge fix for BUG#779885

parents fedeacee 30575353
......@@ -5085,3 +5085,23 @@ GROUP BY b;
b
0
DROP TABLE t1;
#
# BUG#779885: Crash in eliminate_item_equal with materialization=on in maria-5.3
#
CREATE TABLE t1 ( f1 int );
INSERT INTO t1 VALUES (19), (20);
CREATE TABLE t2 ( f10 varchar(32) );
INSERT INTO t2 VALUES ('c'),('d');
CREATE TABLE t3 ( f10 varchar(32) );
INSERT INTO t3 VALUES ('a'),('b');
SELECT *
FROM t1
WHERE
( 't' ) IN (
SELECT t3.f10
FROM t3
JOIN t2
ON t2.f10 = t3.f10
);
f1
DROP TABLE t1,t2,t3;
......@@ -5089,6 +5089,26 @@ GROUP BY b;
b
0
DROP TABLE t1;
#
# BUG#779885: Crash in eliminate_item_equal with materialization=on in maria-5.3
#
CREATE TABLE t1 ( f1 int );
INSERT INTO t1 VALUES (19), (20);
CREATE TABLE t2 ( f10 varchar(32) );
INSERT INTO t2 VALUES ('c'),('d');
CREATE TABLE t3 ( f10 varchar(32) );
INSERT INTO t3 VALUES ('a'),('b');
SELECT *
FROM t1
WHERE
( 't' ) IN (
SELECT t3.f10
FROM t3
JOIN t2
ON t2.f10 = t3.f10
);
f1
DROP TABLE t1,t2,t3;
set optimizer_switch=default;
select @@optimizer_switch like '%materialization=on%';
@@optimizer_switch like '%materialization=on%'
......
......@@ -5086,4 +5086,24 @@ GROUP BY b;
b
0
DROP TABLE t1;
#
# BUG#779885: Crash in eliminate_item_equal with materialization=on in maria-5.3
#
CREATE TABLE t1 ( f1 int );
INSERT INTO t1 VALUES (19), (20);
CREATE TABLE t2 ( f10 varchar(32) );
INSERT INTO t2 VALUES ('c'),('d');
CREATE TABLE t3 ( f10 varchar(32) );
INSERT INTO t3 VALUES ('a'),('b');
SELECT *
FROM t1
WHERE
( 't' ) IN (
SELECT t3.f10
FROM t3
JOIN t2
ON t2.f10 = t3.f10
);
f1
DROP TABLE t1,t2,t3;
set optimizer_switch=default;
......@@ -5086,4 +5086,24 @@ GROUP BY b;
b
0
DROP TABLE t1;
#
# BUG#779885: Crash in eliminate_item_equal with materialization=on in maria-5.3
#
CREATE TABLE t1 ( f1 int );
INSERT INTO t1 VALUES (19), (20);
CREATE TABLE t2 ( f10 varchar(32) );
INSERT INTO t2 VALUES ('c'),('d');
CREATE TABLE t3 ( f10 varchar(32) );
INSERT INTO t3 VALUES ('a'),('b');
SELECT *
FROM t1
WHERE
( 't' ) IN (
SELECT t3.f10
FROM t3
JOIN t2
ON t2.f10 = t3.f10
);
f1
DROP TABLE t1,t2,t3;
set optimizer_switch=default;
......@@ -4352,3 +4352,27 @@ SELECT b FROM t1
GROUP BY b;
DROP TABLE t1;
--echo #
--echo # BUG#779885: Crash in eliminate_item_equal with materialization=on in maria-5.3
--echo #
CREATE TABLE t1 ( f1 int );
INSERT INTO t1 VALUES (19), (20);
CREATE TABLE t2 ( f10 varchar(32) );
INSERT INTO t2 VALUES ('c'),('d');
CREATE TABLE t3 ( f10 varchar(32) );
INSERT INTO t3 VALUES ('a'),('b');
SELECT *
FROM t1
WHERE
( 't' ) IN (
SELECT t3.f10
FROM t3
JOIN t2
ON t2.f10 = t3.f10
);
DROP TABLE t1,t2,t3;
......@@ -10200,7 +10200,15 @@ Item *eliminate_item_equal(COND *cond, COND_EQUAL *upper_levels,
if (eq_item)
eq_list.push_back(eq_item);
Item *head_item= current_sjm? current_sjm_head: head;
/*
If we're inside an SJM-nest (current_sjm!=NULL), and the multi-equality
doesn't include a constant, we should produce equality with the first
of the equals in this SJM.
In other cases, get the "head" item, which is either first of the
equals on top level, or the constant.
*/
Item *head_item= (!item_const && current_sjm)? current_sjm_head: head;
Item *head_real_item= head_item->real_item();
if (head_real_item->type() == Item::FIELD_ITEM)
head_item= head_real_item;
......
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