Commit 837c6722 authored by Sergey Petrunya's avatar Sergey Petrunya

Merge fix for BUG##806524

parents 99cce189 b11eff40
......@@ -477,3 +477,24 @@ WHERE t.f2='s' AND t.f2 LIKE '%a%' OR t.f1<>0 ORDER BY t.f2;
f1
8
DROP TABLE t1, t2;
#
# BUG##806524: Assertion `join->best_read < 1.7976931348623157e+308 with table_elimination=on and derived_merge=on
#
CREATE TABLE t1 ( f4 int) ;
CREATE TABLE t2 ( f4 int) ;
CREATE TABLE t3 ( f1 int NOT NULL , PRIMARY KEY (f1)) ;
CREATE TABLE t4 ( f2 int, f4 int) ;
SELECT *
FROM ( SELECT * FROM t1 ) AS alias1
RIGHT JOIN (
t2 AS alias2
LEFT JOIN (
SELECT t4.*
FROM ( SELECT * FROM t3 ) AS SQ1_alias1
RIGHT JOIN t4
ON t4.f2 = SQ1_alias1.f1
) AS alias3
ON alias3.f4 != 0
) ON alias3.f4 != 0;
f4 f4 f2 f4
drop table t1,t2,t3,t4;
......@@ -385,3 +385,27 @@ SELECT DISTINCT t.f1 FROM (SELECT * FROM t1) AS t, t2
WHERE t.f2='s' AND t.f2 LIKE '%a%' OR t.f1<>0 ORDER BY t.f2;
DROP TABLE t1, t2;
--echo #
--echo # BUG##806524: Assertion `join->best_read < 1.7976931348623157e+308 with table_elimination=on and derived_merge=on
--echo #
CREATE TABLE t1 ( f4 int) ;
CREATE TABLE t2 ( f4 int) ;
CREATE TABLE t3 ( f1 int NOT NULL , PRIMARY KEY (f1)) ;
CREATE TABLE t4 ( f2 int, f4 int) ;
SELECT *
FROM ( SELECT * FROM t1 ) AS alias1
RIGHT JOIN (
t2 AS alias2
LEFT JOIN (
SELECT t4.*
FROM ( SELECT * FROM t3 ) AS SQ1_alias1
RIGHT JOIN t4
ON t4.f2 = SQ1_alias1.f1
) AS alias3
ON alias3.f4 != 0
) ON alias3.f4 != 0;
drop table t1,t2,t3,t4;
......@@ -12003,8 +12003,8 @@ static uint reset_nj_counters(JOIN *join, List<TABLE_LIST> *join_list)
if (!nested_join->n_tables)
is_eliminated_nest= TRUE;
}
if ((!table->table && !is_eliminated_nest) ||
(table->table && (table->table->map & ~join->eliminated_tables)))
if ((table->nested_join && !is_eliminated_nest) ||
(!table->nested_join && (table->table->map & ~join->eliminated_tables)))
n++;
}
DBUG_RETURN(n);
......
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