Commit 50ddf3c1 authored by unknown's avatar unknown

Fixed bug #53334.

The fix actually reverts the change introduced by the patch
for bug 51494
The fact is that the patch for bug 52177 fixes bug 51194 as well.
parent be7c84c7
......@@ -2350,4 +2350,34 @@ Null
Index_type BTREE
Comment
DROP TABLE t1;
#
# Bug #53334: wrong result for outer join with impossible ON condition
# (see the same test case for MyISAM in join.test)
#
create table t1 (id int primary key);
create table t2 (id int);
insert into t1 values (75);
insert into t1 values (79);
insert into t1 values (78);
insert into t1 values (77);
replace into t1 values (76);
replace into t1 values (76);
insert into t1 values (104);
insert into t1 values (103);
insert into t1 values (102);
insert into t1 values (101);
insert into t1 values (105);
insert into t1 values (106);
insert into t1 values (107);
insert into t2 values (107),(75),(1000);
select t1.id,t2.id from t2 left join t1 on t1.id>=74 and t1.id<=0
where t2.id=75 and t1.id is null;
id id
NULL 75
explain select t1.id,t2.id from t2 left join t1 on t1.id>=74 and t1.id<=0
where t2.id=75 and t1.id is null;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 const PRIMARY NULL NULL NULL 1 Impossible ON condition
1 SIMPLE t2 ALL NULL NULL NULL NULL 3 Using where
drop table t1,t2;
End of 5.1 tests
......@@ -591,4 +591,35 @@ ALTER TABLE t1 DROP INDEX k, ADD UNIQUE INDEX k (a,b);
DROP TABLE t1;
--echo #
--echo # Bug #53334: wrong result for outer join with impossible ON condition
--echo # (see the same test case for MyISAM in join.test)
--echo #
create table t1 (id int primary key);
create table t2 (id int);
insert into t1 values (75);
insert into t1 values (79);
insert into t1 values (78);
insert into t1 values (77);
replace into t1 values (76);
replace into t1 values (76);
insert into t1 values (104);
insert into t1 values (103);
insert into t1 values (102);
insert into t1 values (101);
insert into t1 values (105);
insert into t1 values (106);
insert into t1 values (107);
insert into t2 values (107),(75),(1000);
select t1.id,t2.id from t2 left join t1 on t1.id>=74 and t1.id<=0
where t2.id=75 and t1.id is null;
explain select t1.id,t2.id from t2 left join t1 on t1.id>=74 and t1.id<=0
where t2.id=75 and t1.id is null;
drop table t1,t2;
--echo End of 5.1 tests
......@@ -3008,8 +3008,7 @@ make_join_statistics(JOIN *join, TABLE_LIST *tables_arg, COND *conds,
s->quick=select->quick;
s->needed_reg=select->needed_reg;
select->quick=0;
if (records == 0 && s->table->reginfo.impossible_range &&
(s->table->file->ha_table_flags() & HA_STATS_RECORDS_IS_EXACT))
if (records == 0 && s->table->reginfo.impossible_range)
{
/*
Impossible WHERE or ON expression
......
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