Commit 10a56686 authored by unknown's avatar unknown

hang in dummy natural join (no common columns) Bug #4807

parent 2f499fa3
...@@ -283,6 +283,12 @@ ID Value1 Value2 ...@@ -283,6 +283,12 @@ ID Value1 Value2
SELECT * FROM t1 NATURAL JOIN t2 WHERE (Value1 = 'A' AND Value2 <> 'B') AND 1; SELECT * FROM t1 NATURAL JOIN t2 WHERE (Value1 = 'A' AND Value2 <> 'B') AND 1;
ID Value1 Value2 ID Value1 Value2
drop table t1,t2; drop table t1,t2;
CREATE TABLE t1 (a int);
CREATE TABLE t2 (b int);
CREATE TABLE t3 (c int);
SELECT * FROM t1 NATURAL JOIN t2 NATURAL JOIN t3;
a b c
DROP TABLE t1, t2, t3;
create table t1 (i int); create table t1 (i int);
create table t2 (i int); create table t2 (i int);
create table t3 (i int); create table t3 (i int);
......
...@@ -284,6 +284,16 @@ SELECT * FROM t1 NATURAL JOIN t2 WHERE 1 AND Value1 = 'A' AND Value2 <> 'B'; ...@@ -284,6 +284,16 @@ SELECT * FROM t1 NATURAL JOIN t2 WHERE 1 AND Value1 = 'A' AND Value2 <> 'B';
SELECT * FROM t1 NATURAL JOIN t2 WHERE (Value1 = 'A' AND Value2 <> 'B') AND 1; SELECT * FROM t1 NATURAL JOIN t2 WHERE (Value1 = 'A' AND Value2 <> 'B') AND 1;
drop table t1,t2; drop table t1,t2;
#
# dummy natural join (no common columns) Bug #4807
#
CREATE TABLE t1 (a int);
CREATE TABLE t2 (b int);
CREATE TABLE t3 (c int);
SELECT * FROM t1 NATURAL JOIN t2 NATURAL JOIN t3;
DROP TABLE t1, t2, t3;
# #
# Test combination of join methods # Test combination of join methods
# #
......
...@@ -2522,6 +2522,8 @@ int setup_conds(THD *thd,TABLE_LIST *tables,COND **conds) ...@@ -2522,6 +2522,8 @@ int setup_conds(THD *thd,TABLE_LIST *tables,COND **conds)
// to prevent natural join processing during PS re-execution // to prevent natural join processing during PS re-execution
table->natural_join= 0; table->natural_join= 0;
if (cond_and->list.elements)
{
if (!table->outer_join) // Not left join if (!table->outer_join) // Not left join
{ {
*conds= and_conds(*conds, cond_and); *conds= and_conds(*conds, cond_and);
...@@ -2548,6 +2550,7 @@ int setup_conds(THD *thd,TABLE_LIST *tables,COND **conds) ...@@ -2548,6 +2550,7 @@ int setup_conds(THD *thd,TABLE_LIST *tables,COND **conds)
} }
} }
} }
}
if (stmt) if (stmt)
{ {
......
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