Bug #49322 Server is adding extra NULL row on processing a WHERE clause
| Submitted: | 2 Dec 2009 3:20 | Modified: | 11 Mar 2011 12:48 |
|---|---|---|---|
| Reporter: | Patrick Crews | Email Updates: | |
| Status: | Duplicate | Impact on me: | |
| Category: | MySQL Server: Optimizer | Severity: | S3 (Non-critical) |
| Version: | 5.0+ | OS: | Any |
| Assigned to: | Assigned Account | CPU Architecture: | Any |
| Tags: | extra rows, where | ||
[2 Dec 2009 3:20]
Patrick Crews
[23 Nov 2010 8:53]
Shane Bester
a neater testcase from from 5.1.53
drop table if exists h,m,k;
create table `h`(`pk` int not null,`col_int_key` int) engine=myisam;
insert into `h` values (1,null),(4,2),(5,2),(3,4),(2,8);
create table `m` (`pk` int not null,`col_int_key` int) engine=myisam ;
insert into `m` values (1,2),(2,7),(3,5),(4,7),(5,5),(6,null),(7,null),(8,9);
create table `k` (`pk` int not null,`col_int_key` int) engine=myisam;
insert into `k` values (1,9),(2,2),(3,5),(4,2),(5,7),(6,0),(7,5);
/*exhibit A*/select table1.pk from k table1
right join h table2 on table1.`col_int_key`=table2.`col_int_key`
right join m table4 on table2.`col_int_key`=table4.`col_int_key`;
/*exhibit B*/select table1.pk from k table1
right join h table2 on table1.`col_int_key`=table2.`col_int_key`
right join m table4 on table2.`col_int_key`=table4.`col_int_key`
where table1.pk is null;
Notice the extra NULL that appears in exhibit B:
mysql> /*exhibit A*/select table1.pk from k table1
-> right join h table2 on table1.`col_int_key`=table2.`col_int_key`
-> right join m table4 on table2.`col_int_key`=table4.`col_int_key`
+------+
| pk |
+------+
| 2 |
| 4 |
| 2 |
| 4 |
| NULL |
| NULL |
| NULL |
| NULL |
| NULL |
| NULL |
| NULL |
+------+
11 rows in set (0.00 sec)
mysql> /*exhibit B*/select table1.pk from k table1
-> right join h table2 on table1.`col_int_key`=table2.`col_int_key`
-> right join m table4 on table2.`col_int_key`=table4.`col_int_key`
-> where table1.pk is null;
+------+
| pk |
+------+
| NULL |
| NULL |
| NULL |
| NULL |
| NULL |
| NULL |
| NULL |
| NULL |
+------+
8 rows in set (0.00 sec)
[25 Nov 2010 17:54]
Ole John Aske
I suspect this to be a duplicate of bug#58490 which there has been committed a (still unreviewed) fix for.
[25 Nov 2010 22:24]
Ole John Aske
Has tested these testcases with proposed fix for bug#58490. All reported issues are fixed with this, http://lists.mysql.com/commits/125027
[26 Jan 2011 7:25]
Ole John Aske
Closed - as it is a duplicate of bug#58490.
[1 Feb 2011 14:26]
Bugs System
Pushed into mysql-trunk 5.6.2 (revid:ole.john.aske@oracle.com-20110201142457-3hdefsxj12q0acvl) (version source revid:ole.john.aske@oracle.com-20110201142457-3hdefsxj12q0acvl) (merge vers: 5.6.2) (pib:24)
[1 Feb 2011 14:26]
Bugs System
Pushed into mysql-5.5 5.5.10 (revid:ole.john.aske@oracle.com-20110201141934-ppx2z4tn6vv0u8q9) (version source revid:ole.john.aske@oracle.com-20110201141934-ppx2z4tn6vv0u8q9) (merge vers: 5.5.10) (pib:24)
[2 Feb 2011 7:48]
Bugs System
A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/commits/130176 4163 Ole John Aske 2011-02-02 Fix for bug#58490: 'Incorrect result in multi level OUTER JOIN', cherry picked into telco branches. Also fix the duplicate bug#49322. Se original commit http://lists.mysql.com/commits/130129 for comments
[2 Feb 2011 7:48]
Bugs System
Pushed into mysql-5.1-telco-7.0 5.1.51-ndb-7.0.22 (revid:ole.john.aske@oracle.com-20110202074752-4c6jzaiwxvf7rngl) (version source revid:ole.john.aske@oracle.com-20110202074752-4c6jzaiwxvf7rngl) (merge vers: 5.1.51-ndb-7.0.22) (pib:24)
[11 Mar 2011 12:48]
Jon Stephens
Closed as duplicate of BUG#58490 per Ole John's comments above.
Portions of this website are copyright © 2001, 2002 The PHP Group
Page generated in 0.069 sec. using MySQL 8.4.7-u6-cloud
Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the
respective copyright holders.
It is not reviewed in advance
by Oracle and does not necessarily represent the opinion of
Oracle or any other party.