Commit b11eff40 authored by Sergey Petrunya's avatar Sergey Petrunya

BUG##806524: Assertion `join->best_read < 1.7976931348623157e+308 with...

BUG##806524: Assertion `join->best_read < 1.7976931348623157e+308 with table_elimination=on and derived_merge=on 
reset_nj_counters() used to rely on the fact that join nests have 
table->table==NULL. This ceased to be true wit new derived table
optimizations. Use test for table->nested_join!=NULL instead.
parent 5df875b0
...@@ -477,3 +477,24 @@ WHERE t.f2='s' AND t.f2 LIKE '%a%' OR t.f1<>0 ORDER BY t.f2; ...@@ -477,3 +477,24 @@ WHERE t.f2='s' AND t.f2 LIKE '%a%' OR t.f1<>0 ORDER BY t.f2;
f1 f1
8 8
DROP TABLE t1, t2; 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 ...@@ -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; WHERE t.f2='s' AND t.f2 LIKE '%a%' OR t.f1<>0 ORDER BY t.f2;
DROP TABLE t1, t2; 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;
...@@ -11999,8 +11999,8 @@ static uint reset_nj_counters(JOIN *join, List<TABLE_LIST> *join_list) ...@@ -11999,8 +11999,8 @@ static uint reset_nj_counters(JOIN *join, List<TABLE_LIST> *join_list)
if (!nested_join->n_tables) if (!nested_join->n_tables)
is_eliminated_nest= TRUE; is_eliminated_nest= TRUE;
} }
if ((!table->table && !is_eliminated_nest) || if ((table->nested_join && !is_eliminated_nest) ||
(table->table && (table->table->map & ~join->eliminated_tables))) (!table->nested_join && (table->table->map & ~join->eliminated_tables)))
n++; n++;
} }
DBUG_RETURN(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