Bug #19840 Left outer join with 'where or false'
Submitted: 16 May 2006 8:23 Modified: 18 May 2006 3:54
Reporter: Maurizio Sanguinetti Email Updates:
Status: Duplicate Impact on me:
None 
Category:MySQL Server Severity:S2 (Serious)
Version:5.0.20, 5.0.21 OS:Windows (Windows, Linux)
Assigned to: Assigned Account CPU Architecture:Any

[16 May 2006 8:23] Maurizio Sanguinetti
Description:
Different results founds between 5.0.21 and 5.0.19 executing query with 'left outer join', 'where' with 'OR FALSE'.
MySQL 5.0.21 does not give back the expected value.
MySQL 5.0.19 it's ok.

How to repeat:
CREATE TABLE test (code CHAR(20), name CHAR(30));
insert into test (code, name) values ('001', 'Name 001');
insert into test (code, name) values ('002', 'Name 002');
insert into test (code, name) values ('003', 'Name 003');

CREATE TABLE test2 (code CHAR(20), name CHAR(30));
insert into test2 (code, name) values ('001', 'Name 001');
insert into test2 (code, name) values ('002', 'Name 002');

# Test Case 1
select * from test
left outer join test2 on test.code=test2.name
where
1=1 or test.code=test2.code;

# Test Case 2
select * from test
left outer join test2 on test.code=test2.name
where
1=1 or 1=0;

Results with MySQL 5.0.21:
Test Case 1 => ko return 0 record
Test Case 2 => ko return 0 record

Results with MySQL 5.0.19:
Test Case 1 => ok return records
Test Case 2 => ok return records

Suggested fix:
No suggestion. Can be a regression problem related to fix described in this bug ?
http://bugs.mysql.com/bug.php?id=17164
[16 May 2006 10:29] Hartmut Holzgraefe
Works fine up to 5.0.19, fails on .20 and .21 (reproduced on linux)
[16 May 2006 10:53] Hartmut Holzgraefe
mysqltest test case

Attachment: bug19840.tar.gz (application/x-gzip, text), 870 bytes.

[18 May 2006 3:54] Igor Babaev
This is a duplicate of bug #19816 that was fixed today.